diff --git a/Doc/data/python3.10.abi b/Doc/data/python3.10.abi index 1dca3e1c2e3de8..316a4e32ea0213 100644 --- a/Doc/data/python3.10.abi +++ b/Doc/data/python3.10.abi @@ -1675,7 +1675,7 @@ - + @@ -1775,6 +1775,9 @@ + + + @@ -3533,7 +3536,7 @@ - + @@ -3633,6 +3636,9 @@ + + + @@ -3885,27 +3891,27 @@ - + - + - + - + - + - + - + @@ -4637,7 +4643,7 @@ - + @@ -6574,7 +6580,7 @@ - + @@ -8724,37 +8730,37 @@ - - + + - - - + + + - - - + + + - - - + + + - - + + - + - - - + + + @@ -9868,32 +9874,32 @@ - + - - + + - - + + - + - - - + + + - + - + @@ -9907,21 +9913,21 @@ - - + + - + - + - - + + - + @@ -9982,27 +9988,27 @@ - + - + - - + + - + - - + + - + - + @@ -10102,6 +10108,9 @@ + + + @@ -10320,31 +10329,31 @@ - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + @@ -10582,11 +10591,11 @@ - - - - - + + + + + @@ -11967,339 +11976,597 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + + + + - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -12307,7 +12574,7 @@ - + @@ -12315,21 +12582,21 @@ - + - + - + @@ -12405,510 +12672,358 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + - - - - - + + + + - + + + - - - - - - - + + + + - - - - + + + + - - - + + + + - + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - + + + + - - + + + + - - + + + + + + + + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -12943,9 +13058,9 @@ - + - + @@ -12957,83 +13072,83 @@ - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -13047,62 +13162,62 @@ - - + + - + - - - + + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + @@ -13252,7 +13367,7 @@ - + @@ -13272,8 +13387,8 @@ - - + + @@ -13314,7 +13429,7 @@ - + @@ -13334,20 +13449,20 @@ - + - + - + - + - + @@ -13358,31 +13473,31 @@ - + - - - + + + - - - + + + - + - + - + @@ -13390,15 +13505,15 @@ - + - - - + + + @@ -13418,47 +13533,47 @@ - + - + - - + + - + - - - + + + - + - + - + - + - + - + - - + + - + @@ -13466,7 +13581,7 @@ - + @@ -13474,50 +13589,50 @@ - + - + - - + + - + - + - - - + + + - + - + - + - - - - - + + + + + - + @@ -13537,7 +13652,7 @@ - + @@ -13545,18 +13660,18 @@ - - - - + + + + - - + + - + @@ -13577,7 +13692,7 @@ - + @@ -13601,15 +13716,15 @@ - + - + - + @@ -13618,7 +13733,7 @@ - + @@ -13628,39 +13743,39 @@ - - + + - - - + + + - - + + - - + + - + - + - + - + - - - + + + - + @@ -13692,9 +13807,9 @@ - + - + @@ -13709,192 +13824,192 @@ - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - - - + + + + - - + + - - - + + + - + - + - - - + + + - - + + - + - - + + - + - + - + - - - + + + - - - + + + - - + + - + - + - - - + + + - - + + - - + + - - + + - + - - + + - - - + + + - - - - - + + + + + - - + + - - + + - - - - - + + + + + - + - - + + - - + + - - + + - - + + - - - + + + - - - - + + + + - - + + - - + + - - - + + + - - - + + + @@ -13948,239 +14063,239 @@ - - + + - + - - + + - + - + - - - - - + + + + + - - - - + + + + - - + + - - - - - + + + + + - - - - + + + + - + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - + + + + - - - - + + + + - + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - + + + + - - - - - + + + + + - + - + - - + + - - + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + @@ -14215,23 +14330,23 @@ - + - - + + - - + + - + - + - - + + @@ -14245,46 +14360,46 @@ - - + + - - + + - - + + - + - - + + - + - + - + - + - - + + - - + + - - + + @@ -14292,123 +14407,123 @@ - + - - + + - + - + - + - + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - - + + - - + + - + - - + + - + - + - - - + + + - - - + + + - - + + - + - + - - - - + + + + @@ -14438,7 +14553,7 @@ - + @@ -14461,7 +14576,7 @@ - + @@ -14518,26 +14633,26 @@ - + - + - - + + - + - + @@ -14555,7 +14670,7 @@ - + @@ -14564,8 +14679,8 @@ - - + + @@ -14573,86 +14688,86 @@ - - - - - + + + + + - + - + - - + + - - + + - - + + - - + + - - - + + + - - - - + + + + - - + + - + - - + + - + - + - + - + - + - - - + + + - - - + + + @@ -14679,17 +14794,17 @@ - + - + - + - + @@ -14698,92 +14813,92 @@ - - + + - - - + + + - - + + - - + + - + - - + + - - - + + + - + - + - + - - - + + + - - - + + + - - + + - + - - - - - - + + + + + + - - + + - + - + - + - + - - - + + + @@ -14842,14 +14957,14 @@ - + - + @@ -14863,7 +14978,7 @@ - + @@ -14871,20 +14986,20 @@ - - + + - - + + - - + + @@ -14961,12 +15076,12 @@ - - - + + + - + @@ -15040,230 +15155,230 @@ - - - - - + + + + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - + + + + + + + + - + - - - - + + + + - - - + + + - - - + + + - + - + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - + + + + + + + - + - + - + @@ -15277,11 +15392,11 @@ - + - + @@ -15362,10 +15477,10 @@ - + - + @@ -15374,26 +15489,26 @@ - - + + - + - - + + - + - + - + @@ -15471,111 +15586,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -15592,7 +15604,7 @@ - + diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index e3ccc543560849..c10ba5f0108bae 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -148,6 +148,7 @@ struct _ts { uint64_t id; CFrame root_cframe; + int use_tracing; /* XXX signal handlers should also be here */ diff --git a/Python/ceval.c b/Python/ceval.c index 429ddb82bd66d4..83af22bdb38a17 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5476,7 +5476,7 @@ call_trace(Py_tracefunc func, PyObject *obj, if (tstate->tracing) return 0; tstate->tracing++; - tstate->cframe->use_tracing = 0; + tstate->use_tracing = tstate->cframe->use_tracing = 0; if (frame->f_lasti < 0) { frame->f_lineno = frame->f_code->co_firstlineno; } @@ -5486,8 +5486,8 @@ call_trace(Py_tracefunc func, PyObject *obj, } result = func(obj, frame, what, arg); frame->f_lineno = 0; - tstate->cframe->use_tracing = ((tstate->c_tracefunc != NULL) - || (tstate->c_profilefunc != NULL)); + tstate->use_tracing = tstate->cframe->use_tracing = + ((tstate->c_tracefunc != NULL) || (tstate->c_profilefunc != NULL)); tstate->tracing--; return result; } @@ -5501,11 +5501,11 @@ _PyEval_CallTracing(PyObject *func, PyObject *args) PyObject *result; tstate->tracing = 0; - tstate->cframe->use_tracing = ((tstate->c_tracefunc != NULL) - || (tstate->c_profilefunc != NULL)); + tstate->use_tracing = tstate->cframe->use_tracing = + ((tstate->c_tracefunc != NULL) || (tstate->c_profilefunc != NULL)); result = PyObject_Call(func, args, NULL); tstate->tracing = save_tracing; - tstate->cframe->use_tracing = save_use_tracing; + tstate->use_tracing = tstate->cframe->use_tracing = save_use_tracing; return result; } @@ -5556,7 +5556,8 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) tstate->c_profilefunc = NULL; tstate->c_profileobj = NULL; /* Must make sure that tracing is not ignored if 'profileobj' is freed */ - tstate->cframe->use_tracing = tstate->c_tracefunc != NULL; + tstate->use_tracing = tstate->cframe->use_tracing = + tstate->c_tracefunc != NULL; Py_XDECREF(profileobj); Py_XINCREF(arg); @@ -5564,7 +5565,8 @@ _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) tstate->c_profilefunc = func; /* Flag that tracing or profiling is turned on */ - tstate->cframe->use_tracing = (func != NULL) || (tstate->c_tracefunc != NULL); + tstate->use_tracing = tstate->cframe->use_tracing = + (func != NULL) || (tstate->c_tracefunc != NULL); return 0; } @@ -5597,7 +5599,8 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) tstate->c_tracefunc = NULL; tstate->c_traceobj = NULL; /* Must make sure that profiling is not ignored if 'traceobj' is freed */ - tstate->cframe->use_tracing = (tstate->c_profilefunc != NULL); + tstate->use_tracing = tstate->cframe->use_tracing = + (tstate->c_profilefunc != NULL); Py_XDECREF(traceobj); Py_XINCREF(arg); @@ -5605,8 +5608,8 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) tstate->c_tracefunc = func; /* Flag that tracing or profiling is turned on */ - tstate->cframe->use_tracing = ((func != NULL) - || (tstate->c_profilefunc != NULL)); + tstate->use_tracing = tstate->cframe->use_tracing = + ((func != NULL) || (tstate->c_profilefunc != NULL)); return 0; } diff --git a/Python/pystate.c b/Python/pystate.c index aeebd6f61c6d7f..556851f4374787 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -623,6 +623,7 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->recursion_headroom = 0; tstate->stackcheck_counter = 0; tstate->tracing = 0; + tstate->use_tracing = 0; tstate->root_cframe.use_tracing = 0; tstate->cframe = &tstate->root_cframe; tstate->gilstate_counter = 0; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ac49f7867a5cb3..b9ed6ff04145c0 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -253,7 +253,7 @@ sys_audit_tstate(PyThreadState *ts, const char *event, /* Disallow tracing in hooks unless explicitly enabled */ ts->tracing++; - ts->cframe->use_tracing = 0; + ts->use_tracing = ts->cframe->use_tracing = 0; while ((hook = PyIter_Next(hooks)) != NULL) { _Py_IDENTIFIER(__cantrace__); PyObject *o; @@ -266,14 +266,15 @@ sys_audit_tstate(PyThreadState *ts, const char *event, break; } if (canTrace) { - ts->cframe->use_tracing = (ts->c_tracefunc || ts->c_profilefunc); + ts->use_tracing = ts->cframe->use_tracing = + (ts->c_tracefunc || ts->c_profilefunc); ts->tracing--; } PyObject* args[2] = {eventName, eventArgs}; o = _PyObject_FastCallTstate(ts, hook, args, 2); if (canTrace) { ts->tracing++; - ts->cframe->use_tracing = 0; + ts->use_tracing = ts->cframe->use_tracing = 0; } if (!o) { break; @@ -281,7 +282,8 @@ sys_audit_tstate(PyThreadState *ts, const char *event, Py_DECREF(o); Py_CLEAR(hook); } - ts->cframe->use_tracing = (ts->c_tracefunc || ts->c_profilefunc); + ts->use_tracing = ts->cframe->use_tracing = + (ts->c_tracefunc || ts->c_profilefunc); ts->tracing--; if (_PyErr_Occurred(ts)) { goto exit;