Skip to content

Commit 1f00e8c

Browse files
[3.11] GH-91742: Fix pdb crash after jump (GH-94171) (#94176)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
1 parent 852b4d4 commit 1f00e8c

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

Lib/test/test_pdb.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,50 @@ def test_pdb_issue_43318():
13631363
4
13641364
"""
13651365

1366+
def test_pdb_issue_gh_91742():
1367+
"""See GH-91742
13661368
1369+
>>> def test_function():
1370+
... __author__ = "pi"
1371+
... __version__ = "3.14"
1372+
...
1373+
... def about():
1374+
... '''About'''
1375+
... print(f"Author: {__author__!r}",
1376+
... f"Version: {__version__!r}",
1377+
... sep=" ")
1378+
...
1379+
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
1380+
... about()
1381+
1382+
1383+
>>> reset_Breakpoint()
1384+
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
1385+
... 'step',
1386+
... 'next',
1387+
... 'next',
1388+
... 'jump 5',
1389+
... 'continue'
1390+
... ]):
1391+
... test_function()
1392+
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(12)test_function()
1393+
-> about()
1394+
(Pdb) step
1395+
--Call--
1396+
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(5)about()
1397+
-> def about():
1398+
(Pdb) next
1399+
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(7)about()
1400+
-> print(f"Author: {__author__!r}",
1401+
(Pdb) next
1402+
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(8)about()
1403+
-> f"Version: {__version__!r}",
1404+
(Pdb) jump 5
1405+
> <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(5)about()
1406+
-> def about():
1407+
(Pdb) continue
1408+
Author: 'pi' Version: '3.14'
1409+
"""
13671410
@support.requires_subprocess()
13681411
class PdbTestCase(unittest.TestCase):
13691412
def tearDown(self):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :mod:`pdb` crash after jump caused by a null pointer dereference. Patch by Kumar Aditya.

Objects/frameobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static void
418418
frame_stack_pop(PyFrameObject *f)
419419
{
420420
PyObject *v = _PyFrame_StackPop(f->f_frame);
421-
Py_DECREF(v);
421+
Py_XDECREF(v);
422422
}
423423

424424
static PyFrameState

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy