Skip to content

Commit b879dab

Browse files
fix tracing completely
1 parent 1981f50 commit b879dab

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Python/ceval_macros.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
# define BAIL_TRACING_NO_DISPATCH() \
146146
do { \
147147
LEAVE_TRACING(); \
148-
if (!_PyErr_Occurred(tstate)) { \
148+
if (!_PyErr_Occurred(tstate) && !_is_sys_tracing) { \
149149
_PyFrame_SetStackPointer(frame, stack_pointer); \
150150
int _err = _PyOptimizer_Optimize(frame, tstate); \
151151
_PyJIT_FinalizeTracing(tstate); \
@@ -161,7 +161,8 @@
161161
} \
162162
} while (0);
163163
# define RECORD_TRACE_NO_DISPATCH() do { \
164-
if (IS_JIT_TRACING() && add_to_code_trace(tstate, frame, old_code, old_func, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
164+
int _is_sys_tracing = (tstate->c_tracefunc != NULL) || (tstate->c_profilefunc == NULL); \
165+
if (_is_sys_tracing || IS_JIT_TRACING() && add_to_code_trace(tstate, frame, old_code, old_func, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
165166
BAIL_TRACING_NO_DISPATCH(); \
166167
} \
167168
} while (0);
@@ -227,9 +228,6 @@ do { \
227228

228229
#define TRACING_DISPATCH() \
229230
{ \
230-
if (tstate->c_tracefunc || tstate->c_profilefunc) { \
231-
DISPATCH(); \
232-
} \
233231
assert(frame->stackpointer == NULL); \
234232
RECORD_TRACE_NO_DISPATCH(); \
235233
NEXTOPARG(); \

0 commit comments

Comments
 (0)