gh-132536: Do not disable PY_THROW event in bdb (#132537)

This commit is contained in:
Tian Gao 2025-04-15 15:31:52 -07:00 committed by GitHub
parent 4f10b93d1b
commit d19af00b90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 12 deletions

View file

@ -2581,6 +2581,41 @@ def test_pdb_next_command_subiterator():
(Pdb) continue
"""
def test_pdb_breakpoint_with_throw():
"""GH-132536: PY_THROW event should not be turned off
>>> reset_Breakpoint()
>>> def gen():
... yield 0
>>> def test_function():
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
... g = gen()
... try:
... g.throw(TypeError)
... except TypeError:
... pass
>>> with PdbTestInput([
... 'b 7',
... 'continue',
... 'clear 1',
... 'continue',
... ]):
... test_function()
> <doctest test.test_pdb.test_pdb_breakpoint_with_throw[2]>(2)test_function()
-> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
(Pdb) b 7
Breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_with_throw[2]>:7
(Pdb) continue
> <doctest test.test_pdb.test_pdb_breakpoint_with_throw[2]>(7)test_function()
-> pass
(Pdb) clear 1
Deleted breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_with_throw[2]>:7
(Pdb) continue
"""
def test_pdb_multiline_statement():
"""Test for multiline statement