mirror of
https://github.com/python/cpython.git
synced 2025-08-18 15:51:23 +00:00
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.
(cherry picked from commit 81f87bbf9f
)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
9ab4dd4522
commit
799f8489d4
4 changed files with 20 additions and 3 deletions
|
@ -19,7 +19,7 @@ arguments and return values that cannot be transported through the RPC
|
|||
barrier, in particular frame and traceback objects.
|
||||
|
||||
"""
|
||||
|
||||
import reprlib
|
||||
import types
|
||||
from idlelib import debugger
|
||||
|
||||
|
@ -170,7 +170,7 @@ class IdbAdapter:
|
|||
def dict_item(self, did, key):
|
||||
dict = dicttable[did]
|
||||
value = dict[key]
|
||||
value = repr(value) ### can't pickle module 'builtins'
|
||||
value = reprlib.repr(value) ### can't pickle module 'builtins'
|
||||
return value
|
||||
|
||||
#----------end class IdbAdapter----------
|
||||
|
@ -390,4 +390,4 @@ def restart_subprocess_debugger(rpcclt):
|
|||
|
||||
if __name__ == "__main__":
|
||||
from unittest import main
|
||||
main('idlelib.idle_test.test_debugger', verbosity=2, exit=False)
|
||||
main('idlelib.idle_test.test_debugger_r', verbosity=2, exit=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue