mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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 -->
This commit is contained in:
parent
56353b1002
commit
003ba71dcb
4 changed files with 15 additions and 11 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue