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

Function __Pyx_Import

fairseq/fairseq/data/data_utils_fast.cpp:26195–26250  ·  view source on GitHub ↗

Import */

Source from the content-addressed store, hash-verified

26193
26194/* Import */
26195static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
26196 PyObject *module = 0;
26197 PyObject *empty_dict = 0;
26198 PyObject *empty_list = 0;
26199 #if PY_MAJOR_VERSION < 3
26200 PyObject *py_import;
26201 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
26202 if (unlikely(!py_import))
26203 goto bad;
26204 if (!from_list) {
26205 empty_list = PyList_New(0);
26206 if (unlikely(!empty_list))
26207 goto bad;
26208 from_list = empty_list;
26209 }
26210 #endif
26211 empty_dict = PyDict_New();
26212 if (unlikely(!empty_dict))
26213 goto bad;
26214 {
26215 #if PY_MAJOR_VERSION >= 3
26216 if (level == -1) {
26217 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
26218 module = PyImport_ImportModuleLevelObject(
26219 name, __pyx_d, empty_dict, from_list, 1);
26220 if (unlikely(!module)) {
26221 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
26222 goto bad;
26223 PyErr_Clear();
26224 }
26225 }
26226 level = 0;
26227 }
26228 #endif
26229 if (!module) {
26230 #if PY_MAJOR_VERSION < 3
26231 PyObject *py_level = PyInt_FromLong(level);
26232 if (unlikely(!py_level))
26233 goto bad;
26234 module = PyObject_CallFunctionObjArgs(py_import,
26235 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
26236 Py_DECREF(py_level);
26237 #else
26238 module = PyImport_ImportModuleLevelObject(
26239 name, __pyx_d, empty_dict, from_list, level);
26240 #endif
26241 }
26242 }
26243bad:
26244 Py_XDECREF(empty_dict);
26245 Py_XDECREF(empty_list);
26246 #if PY_MAJOR_VERSION < 3
26247 Py_XDECREF(py_import);
26248 #endif
26249 return module;
26250}
26251
26252/* ImportDottedModule */

Calls

no outgoing calls

Tested by

no test coverage detected