summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-04-13 11:08:14 +0100
committerGitHub <noreply@github.com>2021-04-13 11:08:14 +0100
commit9e7b2076fb4380987ad0262c4c0ca900b06475ad (patch)
treed7a4902fa70e0014849fd77f07d89f39bb2e7494 /Python/sysmodule.c
parentc2b7a66b91cdb96fbfdb160f96797208ddc5e436 (diff)
downloadcpython-git-9e7b2076fb4380987ad0262c4c0ca900b06475ad.tar.gz
bpo-43760: Speed up check for tracing in interpreter dispatch (#25276)
* Remove redundant tracing_possible field from interpreter state. * Move 'use_tracing' from tstate onto C stack, for fastest possible checking in dispatch logic. * Add comments stressing the importance stack discipline when dealing with CFrames. * Add NEWS
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 54d70ef056..a36d90f9de 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -252,7 +252,7 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
/* Disallow tracing in hooks unless explicitly enabled */
ts->tracing++;
- ts->use_tracing = 0;
+ ts->cframe->use_tracing = 0;
while ((hook = PyIter_Next(hooks)) != NULL) {
_Py_IDENTIFIER(__cantrace__);
PyObject *o;
@@ -265,14 +265,14 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
break;
}
if (canTrace) {
- ts->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
+ 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->use_tracing = 0;
+ ts->cframe->use_tracing = 0;
}
if (!o) {
break;
@@ -280,7 +280,7 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
Py_DECREF(o);
Py_CLEAR(hook);
}
- ts->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
+ ts->cframe->use_tracing = (ts->c_tracefunc || ts->c_profilefunc);
ts->tracing--;
if (_PyErr_Occurred(ts)) {
goto exit;