[3.12] GH-108976. Keep monitoring data structures valid during de-opt… · python/cpython@3efe7bc · GitHub
Skip to content

Commit 3efe7bc

Browse files
authored
[3.12] GH-108976. Keep monitoring data structures valid during de-optimization during callback. (GH-109131) (#109268)
GH-108976. Keep monitoring data structures valid during de-optimization during callback. (GH-109131)
1 parent 5e917a0 commit 3efe7bc

4 files changed

Lines changed: 77 additions & 55 deletions

File tree

Lib/test/test_monitoring.py

Lines changed: 8 additions & 0 deletions

Lib/test/test_pdb.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,24 @@ def test_pdb_issue_gh_101517():
17991799
(Pdb) continue
18001800
"""
18011801

1802+
def test_pdb_issue_gh_108976():
1803+
"""See GH-108976
1804+
Make sure setting f_trace_opcodes = True won't crash pdb
1805+
>>> def test_function():
1806+
... import sys
1807+
... sys._getframe().f_trace_opcodes = True
1808+
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
1809+
... a = 1
1810+
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
1811+
... 'continue'
1812+
... ]):
1813+
... test_function()
1814+
bdb.Bdb.dispatch: unknown debugging event: 'opcode'
1815+
> <doctest test.test_pdb.test_pdb_issue_gh_108976[0]>(5)test_function()
1816+
-> a = 1
1817+
(Pdb) continue
1818+
"""
1819+
18021820
def test_pdb_ambiguous_statements():
18031821
"""See GH-104301
18041822
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix crash that occurs after de-instrumenting a code object in a monitoring
2+
callback.

Python/instrumentation.c

Lines changed: 49 additions & 55 deletions

0 commit comments

Comments
 (0)