MCPcopy Create free account
hub / github.com/numpy/numpy / PyArray_LookupSpecial_OnInstance

Function PyArray_LookupSpecial_OnInstance

numpy/core/src/common/get_attr_string.h:76–93  ·  view source on GitHub ↗

* PyArray_LookupSpecial_OnInstance: * * Implements incorrect special method lookup rules, that break the python * convention, and looks on the instance, not the type. * * Kept for backwards compatibility. In future, we should deprecate this. */

Source from the content-addressed store, hash-verified

74 * Kept for backwards compatibility. In future, we should deprecate this.
75 */
76static inline PyObject *
77PyArray_LookupSpecial_OnInstance(PyObject *obj, PyObject *name_unicode)
78{
79 PyTypeObject *tp = Py_TYPE(obj);
80
81 /* We do not need to check for special attributes on trivial types */
82 if (_is_basic_python_type(tp)) {
83 return NULL;
84 }
85
86 PyObject *res = PyObject_GetAttr(obj, name_unicode);
87
88 if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
89 PyErr_Clear();
90 }
91
92 return res;
93}
94
95#endif /* NUMPY_CORE_SRC_COMMON_GET_ATTR_STRING_H_ */

Callers 4

PyArray_FromInterfaceFunction · 0.85
PyArray_GetPriorityFunction · 0.85

Calls 1

_is_basic_python_typeFunction · 0.85

Tested by

no test coverage detected