Objects/typeobject/apis/attrs

Source   Edit  

Procs

proc PyObject_LookupSpecial(self: PyObject; attr: PyStrObject): PyObject {.
    ...raises: [], tags: [RootEffect], forbids: [].}

_PyObject_LookupSpecial

Routines to do a method lookup in the type without looking in the instance dictionary (so we can't use PyObject_GetAttr) but still binding it to the instance.

Variants:

  • _PyObject_LookupSpecial() returns NULL without raising an exception

when the _PyType_LookupRef() call fails;

  • lookup_maybe_method() and lookup_method() are internal routines similar

to _PyObject_LookupSpecial(), but can return unbound PyFunction to avoid temporary method object. Pass self as first argument when unbound == 1.

Source   Edit  
proc PyType_LookupRef(typ: PyTypeObject; name: PyStrObject): PyObject {.
    ...raises: [], tags: [RootEffect], forbids: [].}
_PyType_LookupRef Internal API to look for a name through the MRO. This returns a strong reference, and doesn't set an exception! Source   Edit  
proc PyType_LookupRefAndVersion(typ: PyTypeObject; name: PyStrObject): PyObject {.
    ...raises: [], tags: [RootEffect], forbids: [].}
_PyType_LookupRefAndVersion(typ, name, NULL) Source   Edit  
proc PyType_LookupRefAndVersion(typ: PyTypeObject; name: PyStrObject;
                                version: var uint): PyObject {....raises: [],
    tags: [RootEffect], forbids: [].}
_PyType_LookupRefAndVersion Internal API to look for a name through the MRO. This returns a strong reference, and doesn't set an exception! If nonzero, version is set to the value of type->tp_version at the time of the lookup. Source   Edit