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

Method iter_locals

Tools/gdb/libpython.py:1100–1118  ·  view source on GitHub ↗

Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the local variables of this frame

(self)

Source from the content-addressed store, hash-verified

1098 return self._gdbval.is_optimized_out
1099
1100 def iter_locals(self):
1101 '''
1102 Yield a sequence of (name,value) pairs of PyObjectPtr instances, for
1103 the local variables of this frame
1104 '''
1105 if self.is_optimized_out():
1106 return
1107
1108
1109 obj_ptr_ptr = gdb.lookup_type("PyObject").pointer().pointer()
1110
1111 localsplus = self._gdbval["localsplus"]
1112
1113 for i in safe_range(self.co_nlocals):
1114 pyop_value = PyObjectPtr.from_pyobject_ptr(localsplus[i])
1115 if pyop_value.is_null():
1116 continue
1117 pyop_name = PyObjectPtr.from_pyobject_ptr(self.co_localsplusnames[i])
1118 yield (pyop_name, pyop_value)
1119
1120 def _f_special(self, name, convert=PyObjectPtr.from_pyobject_ptr):
1121 return convert(self._gdbval[name])

Callers 4

get_var_by_nameMethod · 0.95
write_reprMethod · 0.95
iter_localsMethod · 0.45
invokeMethod · 0.45

Calls 4

is_optimized_outMethod · 0.95
safe_rangeFunction · 0.85
from_pyobject_ptrMethod · 0.80
is_nullMethod · 0.80

Tested by

no test coverage detected