diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2021-01-10 01:59:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-10 01:59:47 -0500 |
commit | 81f87bbf9f65702062021a78abd9b8f82c98a414 (patch) | |
tree | 5f0289ff5b48515f408ea94919ea9b9842acb588 /Lib/idlelib/idle_test/test_debugger_r.py | |
parent | d16f6176abdecbb7ab231dc78beccfaa095beff6 (diff) | |
download | cpython-81f87bbf9f65702062021a78abd9b8f82c98a414.tar.gz cpython-81f87bbf9f65702062021a78abd9b8f82c98a414.zip |
bpo-33065: Fix problem debugging user classes with __repr__ method (GH-24183)
If __repr__ uses instance attributes, as normal, and one steps
through the __init__ method, debugger may try to get repr before
the instance attributes exist. reprlib.repr handles the error.
Diffstat (limited to 'Lib/idlelib/idle_test/test_debugger_r.py')
-rw-r--r-- | Lib/idlelib/idle_test/test_debugger_r.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/idlelib/idle_test/test_debugger_r.py b/Lib/idlelib/idle_test/test_debugger_r.py index 199f63447ce..638ebd36a74 100644 --- a/Lib/idlelib/idle_test/test_debugger_r.py +++ b/Lib/idlelib/idle_test/test_debugger_r.py @@ -25,5 +25,19 @@ class Test(unittest.TestCase): # Classes GUIProxy, IdbAdapter, FrameProxy, CodeProxy, DictProxy, # GUIAdapter, IdbProxy plus 7 module functions. +class IdbAdapterTest(unittest.TestCase): + + def test_dict_item_noattr(self): # Issue 33065. + + class BinData: + def __repr__(self): + return self.length + + debugger_r.dicttable[0] = {'BinData': BinData()} + idb = debugger_r.IdbAdapter(None) + self.assertTrue(idb.dict_item(0, 'BinData')) + debugger_r.dicttable.clear() + + if __name__ == '__main__': unittest.main(verbosity=2) |