diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2024-05-13 19:21:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-13 19:21:15 (GMT) |
commit | fcdd20ef83e099a227eba5692fffcec1c8b9031b (patch) | |
tree | cbe2bcccb2d758aee09bf1ecf38eb58c8de8f786 /Lib/test/test_pdb.py | |
parent | 2430729afea18073ca11f18f641c07ae8ad2504d (diff) | |
download | cpython-fcdd20ef83e099a227eba5692fffcec1c8b9031b.zip cpython-fcdd20ef83e099a227eba5692fffcec1c8b9031b.tar.gz cpython-fcdd20ef83e099a227eba5692fffcec1c8b9031b.tar.bz2 |
[3.12] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979) (#119008)
* [3.12] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979)
(cherry picked from commit f526314194f7fd15931025f8a4439c1765666e42)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r-- | Lib/test/test_pdb.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 5bdc5f2..24324a3 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -904,6 +904,58 @@ def test_post_mortem(): """ +def test_pdb_return_to_different_file(): + """When pdb returns to a different file, it should not skip if f_trace is + not already set + + >>> import pprint + + >>> class A: + ... def __repr__(self): + ... return 'A' + + >>> def test_function(): + ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + ... pprint.pprint(A()) + + >>> reset_Breakpoint() + >>> with PdbTestInput([ # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE + ... 'b A.__repr__', + ... 'continue', + ... 'return', + ... 'next', + ... 'return', + ... 'return', + ... 'continue', + ... ]): + ... test_function() + > <doctest test.test_pdb.test_pdb_return_to_different_file[2]>(3)test_function() + -> pprint.pprint(A()) + (Pdb) b A.__repr__ + Breakpoint 1 at <doctest test.test_pdb.test_pdb_return_to_different_file[1]>:2 + (Pdb) continue + > <doctest test.test_pdb.test_pdb_return_to_different_file[1]>(3)__repr__() + -> return 'A' + (Pdb) return + --Return-- + > <doctest test.test_pdb.test_pdb_return_to_different_file[1]>(3)__repr__()->'A' + -> return 'A' + (Pdb) next + > ...pprint.py..._safe_repr() + -> return rep,... + (Pdb) return + --Return-- + > ...pprint.py..._safe_repr()->('A'...) + -> return rep,... + (Pdb) return + --Return-- + > ...pprint.py...format()->('A'...) + -> return... + (Pdb) continue + A + """ + + def test_pdb_skip_modules(): """This illustrates the simple case of module skipping. |