diff options
author | Guido van Rossum <guido@python.org> | 2023-07-06 18:39:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-06 18:39:53 (GMT) |
commit | 003ba71dcbe94f0d5cb1d0c56d7f1d5a6dae56f7 (patch) | |
tree | 961b7b5af69c94cc5b2d890a6686926e46b2118e /Python/ceval.c | |
parent | 56353b10023ff12c7c8d6288ae4bf7bdcd5d4b6c (diff) | |
download | cpython-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/ceval.c')
-rw-r--r-- | Python/ceval.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 6714229..0ee95bc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2737,11 +2737,11 @@ _PyUopExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject #endif DPRINTF(3, - "Entering _PyUopExecute for %s (%s:%d) at offset %ld\n", + "Entering _PyUopExecute for %s (%s:%d) at byte offset %ld\n", PyUnicode_AsUTF8(_PyFrame_GetCode(frame)->co_qualname), PyUnicode_AsUTF8(_PyFrame_GetCode(frame)->co_filename), _PyFrame_GetCode(frame)->co_firstlineno, - (long)(frame->prev_instr + 1 - + 2 * (long)(frame->prev_instr + 1 - (_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive)); PyThreadState *tstate = _PyThreadState_GET(); |