diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-01-18 05:09:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 05:09:26 (GMT) |
commit | e7a5577b53885b9432d201417f0dace22acf6804 (patch) | |
tree | 755364e1fc0c600c20d83810b50c5d32d9ca2368 /Lib/idlelib/debugobj.py | |
parent | 35e330ba859c915043d2e9808b44120f67328873 (diff) | |
download | cpython-e7a5577b53885b9432d201417f0dace22acf6804.zip cpython-e7a5577b53885b9432d201417f0dace22acf6804.tar.gz cpython-e7a5577b53885b9432d201417f0dace22acf6804.tar.bz2 |
[3.12] gh-96905: In IDLE code, stop redefining built-ins 'dict' and 'object' (GH-114227) (#114228)
Prefix 'dict' with 'o', 'g', or 'l' for 'object', 'global', or 'local'.
Suffix 'object' with '_'.
(cherry picked from commit 6f4b242a03e521a55f0b9e440703b424ed18ce2f)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/debugobj.py')
-rw-r--r-- | Lib/idlelib/debugobj.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Lib/idlelib/debugobj.py b/Lib/idlelib/debugobj.py index 156377f..fb448ec 100644 --- a/Lib/idlelib/debugobj.py +++ b/Lib/idlelib/debugobj.py @@ -1,3 +1,5 @@ +"""Define tree items for debug stackviewer, which is only user. +""" # XXX TO DO: # - popup menu # - support partial or total redisplay @@ -17,9 +19,9 @@ myrepr.maxstring = 100 myrepr.maxother = 100 class ObjectTreeItem(TreeItem): - def __init__(self, labeltext, object, setfunction=None): + def __init__(self, labeltext, object_, setfunction=None): self.labeltext = labeltext - self.object = object + self.object = object_ self.setfunction = setfunction def GetLabelText(self): return self.labeltext @@ -51,8 +53,8 @@ class ObjectTreeItem(TreeItem): item = make_objecttreeitem( str(key) + " =", value, - lambda value, key=key, object=self.object: - setattr(object, key, value)) + lambda value, key=key, object_=self.object: + setattr(object_, key, value)) sublist.append(item) return sublist @@ -85,8 +87,8 @@ class SequenceTreeItem(ObjectTreeItem): value = self.object[key] except KeyError: continue - def setfunction(value, key=key, object=self.object): - object[key] = value + def setfunction(value, key=key, object_=self.object): + object_[key] = value item = make_objecttreeitem(f"{key!r}:", value, setfunction) sublist.append(item) return sublist @@ -111,13 +113,13 @@ dispatch = { type: ClassTreeItem, } -def make_objecttreeitem(labeltext, object, setfunction=None): - t = type(object) +def make_objecttreeitem(labeltext, object_, setfunction=None): + t = type(object_) if t in dispatch: c = dispatch[t] else: c = ObjectTreeItem - return c(labeltext, object, setfunction) + return c(labeltext, object_, setfunction) def _debug_object_browser(parent): # htest # |