#0 frame_stack_pop ( f=Frame 0x7ffff7fc0078, for file /workspaces/cpython/main.py, line 7, in about ()) at Objects/frameobject.c:421#1 frame_setlineno ( f=Frame 0x7ffff7fc0078, for file /workspaces/cpython/main.py, line 7, in about (), p_new_lineno=<optimized out>, _unused_ignored=<optimized out>) at Objects/frameobject.c:641#2 0x000055555570c906 in _PyObject_GenericSetAttrWithDict (dict=0x0, value=4, name='f_lineno', obj=Frame 0x7ffff7fc0078, for file /workspaces/cpython/main.py, line 7, in about ()) at Objects/object.c:1386
This looks like an old bug, probably dating back to the introduction of LOAD_METHOD.
LOAD_METHOD pushes a NULL to stack, which could cause this crash. LOAD_GLOBAL can also push a NULL, making this bug much easier to trigger.
Activity
dignissimus commented on Jun 21, 2022
Commit cf345e9 introduced this issue.
Running the following minimal example with the below input reproduces the crash.
dignissimus commented on Jun 21, 2022
PDB attempts to set f_lineno but in doing so it seems to try and de-allocate NULL.
cpython/Lib/pdb.py
Line 1172 in 4abab6b
cpython/Objects/frameobject.c
Lines 417 to 422 in 296e4ef
kumaraditya303 commented on Jun 22, 2022
Changing Py_DECREF to Py_XDECREF fixes the issue but I'll let @markshannon decide if it is the correct fix.
cc @markshannon
GDB backtrace:
markshannon commented on Jun 22, 2022
This looks like an old bug, probably dating back to the introduction of LOAD_METHOD.
LOAD_METHOD pushes a NULL to stack, which could cause this crash. LOAD_GLOBAL can also push a NULL, making this bug much easier to trigger.
@kumaraditya303 your fix looks correct.
GH-91742: Fix pdb crash after jump (GH-94171)
pythonGH-91742: Fix pdb crash after jump (pythonGH-94171)
[3.11] GH-91742: Fix pdb crash after jump (GH-94171) (#94176)
kumaraditya303 commented on Jun 24, 2022
Python 3.11 and 3.12 (main) both are fixed now.
However Python 3.10 is also affected but it crashes on different assertion.
python: Python/ceval.c:3040: _PyEval_EvalFrameDefault: Assertion `STACK_LEVEL() <= co->co_stacksize' failed.cc @markshannon
Revert 30935 defer bpo45162 to 312 (#94285)
pablogsal commented on Jun 27, 2022
Removing the 3.11 and 3.12 tags so these are fixed in 3.11 and 3.12.
pablogsal commented on Aug 2, 2022
I'm removing the release blocker flag because 3.10 was already crashing with this. This will be treated as a regular bugfix.
sunmy2019 commented on Jun 17, 2023
Closed as 3.10 is no longer accepting bug fixes