Пример #1
0
 def from_pointer(cls, ptr):
     """ Overrides the default behavior to return the appropriate subtype."""
     if ptr is None:
         return None
     ret = instantiate(cls)
     ret.soul = ptr
     return ret
Пример #2
0
 def from_pointer(cls, ptr):
     """ Overrides the default behavior to return the appropriate subtype."""
     if ptr is None:
         return None
     
     payloadtype = EdgePayload._subtypes[EdgePayload._cget_type(ptr)]
     if payloadtype is GenericPyPayload:
         p = lgs.cpSoul(ptr)
         # this is required to prevent garbage collection of the object
         Py_INCREF(p)
         return p
     ret = instantiate(payloadtype)
     ret.soul = ptr
     return ret