diff options
author | Georg Brandl <georg@python.org> | 2010-07-30 10:29:19 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-07-30 10:29:19 (GMT) |
commit | 3f94089a77d95792c3adc087bbb0309ff9d592dc (patch) | |
tree | 369beca901c97541bcca79785bfbc8139c8f97db /Lib/test/test_pdb.py | |
parent | d72e043bddf965ce1cdc7a85baef1d3e929df070 (diff) | |
download | cpython-3f94089a77d95792c3adc087bbb0309ff9d592dc.zip cpython-3f94089a77d95792c3adc087bbb0309ff9d592dc.tar.gz cpython-3f94089a77d95792c3adc087bbb0309ff9d592dc.tar.bz2 |
#5294: Fix the behavior of pdb "continue" command when called in the top-level debugged frame.
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r-- | Lib/test/test_pdb.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 4af8516..00ff4b7 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -122,6 +122,48 @@ def test_pdb_skip_modules_with_callback(): """ +def test_pdb_continue_in_bottomframe(): + """Test that "continue" and "next" work properly in bottom frame (issue #5294). + + >>> def test_function(): + ... import pdb, sys; inst = pdb.Pdb() + ... inst.set_trace() + ... inst.botframe = sys._getframe() # hackery to get the right botframe + ... print(1) + ... print(2) + ... print(3) + ... print(4) + + >>> with PdbTestInput([ + ... 'next', + ... 'break 7', + ... 'continue', + ... 'next', + ... 'continue', + ... 'continue', + ... ]): + ... test_function() + > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(4)test_function() + -> inst.botframe = sys._getframe() # hackery to get the right botframe + (Pdb) next + > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(5)test_function() + -> print(1) + (Pdb) break 7 + Breakpoint 1 at <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>:7 + (Pdb) continue + 1 + 2 + > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(7)test_function() + -> print(3) + (Pdb) next + 3 + > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(8)test_function() + -> print(4) + (Pdb) continue + 4 + """ + + def pdb_invoke(method, arg): """Run pdb.method(arg).""" import pdb; getattr(pdb, method)(arg) |