MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / __Pyx__Import

Function __Pyx__Import

_pydevd_frame_eval/pydevd_frame_evaluator.c:22317–22368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22315 return 0;
22316}
22317static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
22318 PyObject *module = 0;
22319 PyObject *empty_dict = 0;
22320 PyObject *from_list = 0;
22321 int module_found;
22322 if (!qualname) {
22323 qualname = name;
22324 }
22325 module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
22326 if (likely(module_found == 1)) {
22327 return module;
22328 } else if (unlikely(module_found == -1)) {
22329 return NULL;
22330 }
22331 empty_dict = PyDict_New();
22332 if (unlikely(!empty_dict))
22333 goto bad;
22334 if (imported_names) {
22335#if CYTHON_COMPILING_IN_CPYTHON
22336 from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
22337 if (unlikely(!from_list))
22338 goto bad;
22339#else
22340 from_list = PyList_New(len_imported_names);
22341 if (unlikely(!from_list)) goto bad;
22342 for (Py_ssize_t i=0; i<len_imported_names; ++i) {
22343 if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
22344 }
22345#endif
22346 }
22347 if (level == -1) {
22348 const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
22349 if (package_sep != (0)) {
22350 module = PyImport_ImportModuleLevelObject(
22351 name, moddict, empty_dict, from_list, 1);
22352 if (unlikely(!module)) {
22353 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
22354 goto bad;
22355 PyErr_Clear();
22356 }
22357 }
22358 level = 0;
22359 }
22360 if (!module) {
22361 module = PyImport_ImportModuleLevelObject(
22362 name, moddict, empty_dict, from_list, level);
22363 }
22364bad:
22365 Py_XDECREF(from_list);
22366 Py_XDECREF(empty_dict);
22367 return module;
22368}
22369
22370/* Import */
22371static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {

Callers 1

__Pyx_ImportFunction · 0.85

Calls 3

__Pyx__Import_LookupFunction · 0.85
__Pyx_PyList_FromArrayFunction · 0.85
__Pyx_NewRefFunction · 0.85

Tested by

no test coverage detected