mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-111798: Use lower Py_C_RECURSION_LIMIT in debug mode (#112124)
* Run again test_ast_recursion_limit() on WASI platform. * Add _testinternalcapi.get_c_recursion_remaining(). * Fix test_ast and test_sys_settrace: test_ast_recursion_limit() and test_trace_unpack_long_sequence() now adjust the maximum recursion depth depending on the the remaining C recursion.
This commit is contained in:
parent
81ab0e8a4a
commit
bd89bca9e2
5 changed files with 37 additions and 5 deletions
|
|
@ -109,6 +109,14 @@ get_recursion_depth(PyObject *self, PyObject *Py_UNUSED(args))
|
|||
}
|
||||
|
||||
|
||||
static PyObject*
|
||||
get_c_recursion_remaining(PyObject *self, PyObject *Py_UNUSED(args))
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
return PyLong_FromLong(tstate->c_recursion_remaining);
|
||||
}
|
||||
|
||||
|
||||
static PyObject*
|
||||
test_bswap(PyObject *self, PyObject *Py_UNUSED(args))
|
||||
{
|
||||
|
|
@ -1611,6 +1619,7 @@ perf_trampoline_set_persist_after_fork(PyObject *self, PyObject *args)
|
|||
static PyMethodDef module_functions[] = {
|
||||
{"get_configs", get_configs, METH_NOARGS},
|
||||
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
|
||||
{"get_c_recursion_remaining", get_c_recursion_remaining, METH_NOARGS},
|
||||
{"test_bswap", test_bswap, METH_NOARGS},
|
||||
{"test_popcount", test_popcount, METH_NOARGS},
|
||||
{"test_bit_length", test_bit_length, METH_NOARGS},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue