numpy
2.0.0
|
00001 #ifndef NPY_IMPORT_H 00002 #define NPY_IMPORT_H 00003 00004 #include <Python.h> 00005 00019 NPY_INLINE static void 00020 npy_cache_import(const char *module, const char *attr, PyObject **cache) 00021 { 00022 if (*cache == NULL) { 00023 PyObject *mod = PyImport_ImportModule(module); 00024 00025 if (mod != NULL) { 00026 *cache = PyObject_GetAttrString(mod, attr); 00027 Py_DECREF(mod); 00028 } 00029 } 00030 } 00031 00032 #endif