closes bpo-42726: gdb libpython: InstanceProxy support for py3 (GH-23912)

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
(cherry picked from commit b57ada98da)

Co-authored-by: Augusto Hack <hack.augusto@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-12-24 09:34:28 -08:00 committed by GitHub
parent 412c935a37
commit efd64c8ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Fixed Python 3 compatibility issue with gdb/libpython.py handling of attribute
dictionaries.

View File

@ -468,7 +468,7 @@ class InstanceProxy(object):
def __repr__(self): def __repr__(self):
if isinstance(self.attrdict, dict): if isinstance(self.attrdict, dict):
kwargs = ', '.join(["%s=%r" % (arg, val) 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, return '<%s(%s) at remote 0x%x>' % (self.cl_name,
kwargs, self.address) kwargs, self.address)
else: else: