summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-29 08:43:52 (GMT)
committerGitHub <noreply@github.com>2022-07-29 08:43:52 (GMT)
commit00566a8124e16b8f9403395b42a722edef2b0583 (patch)
treec756e440a84a4f1f1a9d035e5308df3c203e7b55 /Python
parentf06f3656c5e98843d4666d22df0b2c5dd62c87ae (diff)
downloadcpython-00566a8124e16b8f9403395b42a722edef2b0583.zip
cpython-00566a8124e16b8f9403395b42a722edef2b0583.tar.gz
cpython-00566a8124e16b8f9403395b42a722edef2b0583.tar.bz2
GH-90081: Run python tracers at full speed (GH-95328) (#95363)
(cherry picked from commit b8b2990fb3218cffedfe7bc92e9e7ae2275b3c98) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Mark Shannon <mark@hotpy.org>
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 31cdb55..23733b6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5590,7 +5590,7 @@ handle_eval_breaker:
assert(oparg);
oparg <<= 8;
oparg |= _Py_OPARG(*next_instr);
- // We might be tracing. To avoid breaking tracing guarantees in
+ // We might be tracing. To avoid breaking tracing guarantees in
// quickened instructions, always deoptimize the next opcode:
opcode = _PyOpcode_Deopt[_Py_OPCODE(*next_instr)];
PRE_DISPATCH_GOTO();
@@ -5620,9 +5620,9 @@ handle_eval_breaker:
case DO_TRACING:
#endif
{
- if (tstate->tracing == 0 &&
- INSTR_OFFSET() >= frame->f_code->_co_firsttraceable
- ) {
+ assert(cframe.use_tracing);
+ assert(tstate->tracing == 0);
+ if (INSTR_OFFSET() >= frame->f_code->_co_firsttraceable) {
int instr_prev = _PyInterpreterFrame_LASTI(frame);
frame->prev_instr = next_instr;
TRACING_NEXTOPARG();
@@ -6832,12 +6832,15 @@ void
PyThreadState_EnterTracing(PyThreadState *tstate)
{
tstate->tracing++;
+ tstate->cframe->use_tracing = 0;
}
void
PyThreadState_LeaveTracing(PyThreadState *tstate)
{
+ assert(tstate->tracing > 0 && tstate->cframe->use_tracing == 0);
tstate->tracing--;
+ _PyThreadState_UpdateTracingState(tstate);
}
static int