diff options
author | Mark Shannon <mark@hotpy.org> | 2023-09-12 14:14:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 14:14:49 (GMT) |
commit | 3efe7bc65f45ea568e71b16458e2d956be30b6c7 (patch) | |
tree | 37905bcbda23e92df31facacc0d78cedca311f31 /Lib | |
parent | 5e917a0b09dbd86cff88b04501898e72ade574d5 (diff) | |
download | cpython-3efe7bc65f45ea568e71b16458e2d956be30b6c7.zip cpython-3efe7bc65f45ea568e71b16458e2d956be30b6c7.tar.gz cpython-3efe7bc65f45ea568e71b16458e2d956be30b6c7.tar.bz2 |
[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)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_monitoring.py | 8 | ||||
-rw-r--r-- | Lib/test/test_pdb.py | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_monitoring.py b/Lib/test/test_monitoring.py index 8665c35..2e4ec24 100644 --- a/Lib/test/test_monitoring.py +++ b/Lib/test/test_monitoring.py @@ -1718,3 +1718,11 @@ class TestRegressions(MonitoringTestBase, unittest.TestCase): make_foo_optimized_then_set_event() finally: sys.monitoring.set_events(TEST_TOOL, 0) + + def test_gh108976(self): + sys.monitoring.use_tool_id(0, "test") + sys.monitoring.set_events(0, 0) + sys.monitoring.register_callback(0, E.LINE, lambda *args: sys.monitoring.set_events(0, 0)) + sys.monitoring.register_callback(0, E.INSTRUCTION, lambda *args: 0) + sys.monitoring.set_events(0, E.LINE | E.INSTRUCTION) + sys.monitoring.set_events(0, 0) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 83c7cdf..5793dbf 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1799,6 +1799,24 @@ def test_pdb_issue_gh_101517(): (Pdb) continue """ +def test_pdb_issue_gh_108976(): + """See GH-108976 + Make sure setting f_trace_opcodes = True won't crash pdb + >>> def test_function(): + ... import sys + ... sys._getframe().f_trace_opcodes = True + ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + ... a = 1 + >>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE + ... 'continue' + ... ]): + ... test_function() + bdb.Bdb.dispatch: unknown debugging event: 'opcode' + > <doctest test.test_pdb.test_pdb_issue_gh_108976[0]>(5)test_function() + -> a = 1 + (Pdb) continue + """ + def test_pdb_ambiguous_statements(): """See GH-104301 |