mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
GH-91742: Fix pdb crash after jump (GH-94171)
This commit is contained in:
parent
89285314bd
commit
5b6e5762ca
@ -1363,7 +1363,50 @@ def test_pdb_issue_43318():
|
||||
4
|
||||
"""
|
||||
|
||||
def test_pdb_issue_gh_91742():
|
||||
"""See GH-91742
|
||||
|
||||
>>> def test_function():
|
||||
... __author__ = "pi"
|
||||
... __version__ = "3.14"
|
||||
...
|
||||
... def about():
|
||||
... '''About'''
|
||||
... print(f"Author: {__author__!r}",
|
||||
... f"Version: {__version__!r}",
|
||||
... sep=" ")
|
||||
...
|
||||
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
|
||||
... about()
|
||||
|
||||
|
||||
>>> reset_Breakpoint()
|
||||
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
|
||||
... 'step',
|
||||
... 'next',
|
||||
... 'next',
|
||||
... 'jump 5',
|
||||
... 'continue'
|
||||
... ]):
|
||||
... test_function()
|
||||
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(12)test_function()
|
||||
-> about()
|
||||
(Pdb) step
|
||||
--Call--
|
||||
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(5)about()
|
||||
-> def about():
|
||||
(Pdb) next
|
||||
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(7)about()
|
||||
-> print(f"Author: {__author__!r}",
|
||||
(Pdb) next
|
||||
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(8)about()
|
||||
-> f"Version: {__version__!r}",
|
||||
(Pdb) jump 5
|
||||
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(5)about()
|
||||
-> def about():
|
||||
(Pdb) continue
|
||||
Author: 'pi' Version: '3.14'
|
||||
"""
|
||||
@support.requires_subprocess()
|
||||
class PdbTestCase(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
|
@ -0,0 +1 @@
|
||||
Fix :mod:`pdb` crash after jump caused by a null pointer dereference. Patch by Kumar Aditya.
|
@ -418,7 +418,7 @@ static void
|
||||
frame_stack_pop(PyFrameObject *f)
|
||||
{
|
||||
PyObject *v = _PyFrame_StackPop(f->f_frame);
|
||||
Py_DECREF(v);
|
||||
Py_XDECREF(v);
|
||||
}
|
||||
|
||||
static PyFrameState
|
||||
|
Loading…
Reference in New Issue
Block a user