MCPcopy Index your code
hub / github.com/python/cpython / iteritems

Method iteritems

Tools/gdb/libpython.py:783–803  ·  view source on GitHub ↗

Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs, analogous to dict.iteritems()

(self)

Source from the content-addressed store, hash-verified

781 _typename = 'PyDictObject'
782
783 def iteritems(self):
784 '''
785 Yields a sequence of (PyObjectPtr key, PyObjectPtr value) pairs,
786 analogous to dict.iteritems()
787 '''
788 keys = self.field('ma_keys')
789 values = self.field('ma_values')
790 has_values = int(values)
791 if has_values:
792 values = values['values']
793 if has_values:
794 for item in items_from_keys_and_values(keys, values):
795 yield item
796 return
797 entries, nentries = self._get_entries(keys)
798 for i in safe_range(nentries):
799 ep = entries[i]
800 pyop_value = PyObjectPtr.from_pyobject_ptr(ep['me_value'])
801 if not pyop_value.is_null():
802 pyop_key = PyObjectPtr.from_pyobject_ptr(ep['me_key'])
803 yield (pyop_key, pyop_value)
804
805 def proxyval(self, visited):
806 # Guard against infinite loops:

Callers 5

proxyvalMethod · 0.95
write_reprMethod · 0.95
_write_instance_reprFunction · 0.45
iter_globalsMethod · 0.45
iter_builtinsMethod · 0.45

Calls 6

_get_entriesMethod · 0.95
safe_rangeFunction · 0.85
fieldMethod · 0.80
from_pyobject_ptrMethod · 0.80
is_nullMethod · 0.80

Tested by

no test coverage detected