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

Method from_pyobject_ptr

Tools/gdb/libpython.py:386–399  ·  view source on GitHub ↗

Try to locate the appropriate derived class dynamically, and cast the pointer accordingly.

(cls, gdbval)

Source from the content-addressed store, hash-verified

384
385 @classmethod
386 def from_pyobject_ptr(cls, gdbval):
387 '''
388 Try to locate the appropriate derived class dynamically, and cast
389 the pointer accordingly.
390 '''
391 try:
392 p = PyObjectPtr(gdbval)
393 cls = cls.subclass_from_type(p.type())
394 return cls(gdbval, cast_to=cls.get_gdb_type())
395 except RuntimeError:
396 # Handle any kind of error e.g. NULL ptrs by simply using the base
397 # class
398 pass
399 return cls(gdbval)
400
401 @classmethod
402 def get_gdb_type(cls):

Callers 12

pyop_fieldMethod · 0.80
get_attr_dictMethod · 0.80
iteritemsMethod · 0.80
proxyvalMethod · 0.80
write_reprMethod · 0.80
__init__Method · 0.80
iter_localsMethod · 0.80
__iter__Method · 0.80
proxyvalMethod · 0.80
write_reprMethod · 0.80
to_stringMethod · 0.80

Calls 5

typeMethod · 0.95
PyObjectPtrClass · 0.85
subclass_from_typeMethod · 0.80
get_gdb_typeMethod · 0.80
clsClass · 0.50

Tested by

no test coverage detected