]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-42726: gdb libpython: InstanceProxy support for py3 (GH-23912)
authorAugusto Hack <hack.augusto@gmail.com>
Thu, 24 Dec 2020 17:16:04 +0000 (18:16 +0100)
committerGitHub <noreply@github.com>
Thu, 24 Dec 2020 17:16:04 +0000 (09:16 -0800)
On Fedora 31 gdb is using python 3.7.9, calling `proxyval` on an instance with a dictionary fails because of the `dict.iteritems` usage. This PR changes the code to be compatible with py2 and py3.

This changed seemed small enough to not need an issue and news blurb, if one is required please let me know.

Automerge-Triggered-By: GH:benjaminp
Misc/NEWS.d/next/Tools-Demos/2020-12-23-19-42-11.bpo-42726.a5EkTv.rst [new file with mode: 0644]
Tools/gdb/libpython.py

diff --git a/Misc/NEWS.d/next/Tools-Demos/2020-12-23-19-42-11.bpo-42726.a5EkTv.rst b/Misc/NEWS.d/next/Tools-Demos/2020-12-23-19-42-11.bpo-42726.a5EkTv.rst
new file mode 100644 (file)
index 0000000..01a6e7f
--- /dev/null
@@ -0,0 +1,2 @@
+Fixed Python 3 compatibility issue with gdb/libpython.py handling of attribute
+dictionaries.
index e6555dd96a373b7619c9c9080dea77c1ebb2933c..e18ab0d873cce93a8571e9a4457080f94e3185cd 100755 (executable)
@@ -468,7 +468,7 @@ class InstanceProxy(object):
     def __repr__(self):
         if isinstance(self.attrdict, dict):
             kwargs = ', '.join(["%s=%r" % (arg, val)
-                                for arg, val in self.attrdict.iteritems()])
+                                for arg, val in self.attrdict.items()])
             return '<%s(%s) at remote 0x%x>' % (self.cl_name,
                                                 kwargs, self.address)
         else: