summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-07-22 18:04:20 (GMT)
committerGitHub <noreply@github.com>2022-07-22 18:04:20 (GMT)
commite402b26b7fb953a2f0c17a0044bb6d6cbd726e54 (patch)
treeb0b4dc8fd76d64028e0018066de86900949364e4 /Python/ceval.c
parent79d2f549adcbbefd4f2c0a0c9dd572bbbf252c62 (diff)
downloadcpython-e402b26b7fb953a2f0c17a0044bb6d6cbd726e54.zip
cpython-e402b26b7fb953a2f0c17a0044bb6d6cbd726e54.tar.gz
cpython-e402b26b7fb953a2f0c17a0044bb6d6cbd726e54.tar.bz2
GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 88d13c8..3a9b0e5 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5631,8 +5631,16 @@ handle_eval_breaker:
assert(oparg);
oparg <<= 8;
oparg |= _Py_OPARG(*next_instr);
+ // 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();
+ // CPython hasn't traced the following instruction historically
+ // (DO_TRACING would clobber our extended oparg anyways), so just
+ // skip our usual cframe.use_tracing check before dispatch. Also,
+ // make sure the next instruction isn't a RESUME, since that needs
+ // to trace properly (and shouldn't have an extended arg anyways):
+ assert(opcode != RESUME);
DISPATCH_GOTO();
}