summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-07-22 18:56:10 (GMT)
committerGitHub <noreply@github.com>2022-07-22 18:56:10 (GMT)
commit5a48ab01e93c92594eac777c499d1e728ddf1f7e (patch)
tree5290c6976cfbacf7664ef221c3c2057cff11faf7 /Python/ceval.c
parente99496e1c20253d0d2e2e016509cd9c2fa24dd85 (diff)
downloadcpython-5a48ab01e93c92594eac777c499d1e728ddf1f7e.zip
cpython-5a48ab01e93c92594eac777c499d1e728ddf1f7e.tar.gz
cpython-5a48ab01e93c92594eac777c499d1e728ddf1f7e.tar.bz2
[3.11] GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121) (GH-95143)
(cherry picked from commit e402b26b7fb953a2f0c17a0044bb6d6cbd726e54)
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 c69ea21..d40bf27 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5590,8 +5590,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();
}