summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-07-06 18:39:53 (GMT)
committerGitHub <noreply@github.com>2023-07-06 18:39:53 (GMT)
commit003ba71dcbe94f0d5cb1d0c56d7f1d5a6dae56f7 (patch)
tree961b7b5af69c94cc5b2d890a6686926e46b2118e /Python/bytecodes.c
parent56353b10023ff12c7c8d6288ae4bf7bdcd5d4b6c (diff)
downloadcpython-003ba71dcbe94f0d5cb1d0c56d7f1d5a6dae56f7.zip
cpython-003ba71dcbe94f0d5cb1d0c56d7f1d5a6dae56f7.tar.gz
cpython-003ba71dcbe94f0d5cb1d0c56d7f1d5a6dae56f7.tar.bz2
gh-104584: Fix error handling from backedge optimization (#106484)
When `_PyOptimizer_BackEdge` returns `NULL`, we should restore `next_instr` (and `stack_pointer`). To accomplish this we should jump to `resume_with_error` instead of just `error`. The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b139bcc47f5ea094bfaa9824f79bc45adc. But the fix is real (as shown later in that PR). While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with `dis` output. <!-- gh-issue-number: gh-104584 --> * Issue: gh-104584 <!-- /gh-issue-number -->
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index f69ac2b..70b5239 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2234,7 +2234,7 @@ dummy_func(
frame = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer);
if (frame == NULL) {
frame = cframe.current_frame;
- goto error;
+ goto resume_with_error;
}
assert(frame == cframe.current_frame);
here[1].cache &= ((1 << OPTIMIZER_BITS_IN_COUNTER) -1);