MCPcopy Create free account
hub / github.com/Sally-SH/VSP-LLM / __Pyx_PyObject_GetMethod

Function __Pyx_PyObject_GetMethod

fairseq/fairseq/data/data_utils_fast.cpp:27425–27523  ·  view source on GitHub ↗

PyObjectGetMethod */

Source from the content-addressed store, hash-verified

27423
27424/* PyObjectGetMethod */
27425 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
27426 PyObject *attr;
27427#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
27428 __Pyx_TypeName type_name;
27429 PyTypeObject *tp = Py_TYPE(obj);
27430 PyObject *descr;
27431 descrgetfunc f = NULL;
27432 PyObject **dictptr, *dict;
27433 int meth_found = 0;
27434 assert (*method == NULL);
27435 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
27436 attr = __Pyx_PyObject_GetAttrStr(obj, name);
27437 goto try_unpack;
27438 }
27439 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
27440 return 0;
27441 }
27442 descr = _PyType_Lookup(tp, name);
27443 if (likely(descr != NULL)) {
27444 Py_INCREF(descr);
27445#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
27446 if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
27447#elif PY_MAJOR_VERSION >= 3
27448 #ifdef __Pyx_CyFunction_USED
27449 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
27450 #else
27451 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
27452 #endif
27453#else
27454 #ifdef __Pyx_CyFunction_USED
27455 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
27456 #else
27457 if (likely(PyFunction_Check(descr)))
27458 #endif
27459#endif
27460 {
27461 meth_found = 1;
27462 } else {
27463 f = Py_TYPE(descr)->tp_descr_get;
27464 if (f != NULL && PyDescr_IsData(descr)) {
27465 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
27466 Py_DECREF(descr);
27467 goto try_unpack;
27468 }
27469 }
27470 }
27471 dictptr = _PyObject_GetDictPtr(obj);
27472 if (dictptr != NULL && (dict = *dictptr) != NULL) {
27473 Py_INCREF(dict);
27474 attr = __Pyx_PyDict_GetItemStr(dict, name);
27475 if (attr != NULL) {
27476 Py_INCREF(attr);
27477 Py_DECREF(dict);
27478 Py_XDECREF(descr);
27479 goto try_unpack;
27480 }
27481 Py_DECREF(dict);
27482 }

Callers 1

Calls 2

__Pyx_PyDict_GetItemStrFunction · 0.70
__Pyx_PyType_GetNameFunction · 0.70

Tested by

no test coverage detected