8000 gh-59013: Make line number of function breakpoint more precise by gaogaotiantian · Pull Request #110582 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-59013: Make line number of function breakpoint more precise #110582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 27, 2023
Merged
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
Merge branch 'main' into pdb-func-break
  • Loading branch information
gaogaotiantian committed Oct 12, 2023
commit b6d95e30c32d02b048f25b4d09cc42c279f43420
47 changes: 47 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,53 @@ def test_pdb_function_break():
(Pdb) continue
"""

def test_pdb_issue_gh_65052():
"""See GH-65052

args, retval and display should not crash if the object is not displayable
>>> class A:
... def __new__(cls):
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
... return object.__new__(cls)
... def __init__(self):
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
... self.a = 1
... def __repr__(self):
... return self.a

>>> def test_function():
... A()
>>> with PdbTestInput([ # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
... 's',
... 'retval',
... 'continue',
... 'args',
... 'display self',
... 'display',
... 'continue',
... ]):
... test_function()
> <doctest test.test_pdb.test_pdb_issue_gh_65052[0]>(4)__new__()
-> return object.__new__(cls)
(Pdb) s
--Return--
> <doctest test.test_pdb.test_pdb_issue_gh_65052[0]>(4)__new__()-><A instance at ...>
-> return object.__new__(cls)
(Pdb) retval
*** repr(retval) failed: AttributeError: 'A' object has no attribute 'a' ***
(Pdb) continue
> <doctest test.test_pdb.test_pdb_issue_gh_65052[0]>(7)__init__()
-> self.a = 1
(Pdb) args
self = *** repr(self) failed: AttributeError: 'A' object has no attribute 'a' ***
(Pdb) display self
display self: *** repr(self) failed: AttributeError: 'A' object has no attribute 'a' ***
(Pdb) display
Currently displaying:
self: *** repr(self) failed: AttributeError: 'A' object has no attribute 'a' ***
(Pdb) continue
"""


@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0