Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add regression tests
  • Loading branch information
gaogaotiantian committed Sep 7, 2023
commit 7ee7d1dd5131862c568909128fc8f0a4d0bb7970
9 changes: 9 additions & 0 deletions Lib/test/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,15 @@ def func1():
('instruction', 'func1', 14),
('line', 'get_events', 11)])

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)


class TestInstallIncrementallly(MonitoringTestBase, unittest.TestCase):

def check_events(self, func, must_include, tool=TEST_TOOL, recorders=(ExceptionRecorder,)):
Expand Down
21 changes: 21 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,27 @@ 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

Expand Down