diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-23 15:24:50 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-23 15:24:50 (GMT) |
commit | 7d95e4072169911b228c9e42367afb5f17fd3db0 (patch) | |
tree | d07731f1b71b1eb5f653778141ca586069d216b1 /Tools | |
parent | 80d07f825108761af9fe2ac79c1ef50289c07c08 (diff) | |
download | cpython-7d95e4072169911b228c9e42367afb5f17fd3db0.zip cpython-7d95e4072169911b228c9e42367afb5f17fd3db0.tar.gz cpython-7d95e4072169911b228c9e42367afb5f17fd3db0.tar.bz2 |
Implement PEP 412: Key-sharing dictionaries (closes #13903)
Patch from Mark Shannon.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/gdb/libpython.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index 30347cb..cf67cf8 100644 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -634,9 +634,14 @@ class PyDictObjectPtr(PyObjectPtr): Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs, analagous to dict.iteritems() ''' - for i in safe_range(self.field('ma_mask') + 1): - ep = self.field('ma_table') + i - pyop_value = PyObjectPtr.from_pyobject_ptr(ep['me_value']) + keys = self.field('ma_keys') + values = self.field('ma_values') + for i in safe_range(keys['dk_size']): + ep = keys['dk_entries'].address + i + if long(values): + pyop_value = PyObjectPtr.from_pyobject_ptr(values[i]) + else: + pyop_value = PyObjectPtr.from_pyobject_ptr(ep['me_value']) if not pyop_value.is_null(): pyop_key = PyObjectPtr.from_pyobject_ptr(ep['me_key']) yield (pyop_key, pyop_value) |