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

Function __Pyx_ImportFrom

_pydevd_frame_eval/pydevd_frame_evaluator.c:22376–22412  ·  view source on GitHub ↗

ImportFrom */

Source from the content-addressed store, hash-verified

22374
22375/* ImportFrom */
22376static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
22377 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
22378 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
22379 const char* module_name_str = 0;
22380 PyObject* module_name = 0;
22381 PyObject* module_dot = 0;
22382 PyObject* full_name = 0;
22383 PyErr_Clear();
22384 module_name_str = PyModule_GetName(module);
22385 if (unlikely(!module_name_str)) { goto modbad; }
22386 module_name = PyUnicode_FromString(module_name_str);
22387 if (unlikely(!module_name)) { goto modbad; }
22388 module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__3);
22389 if (unlikely(!module_dot)) { goto modbad; }
22390 full_name = PyUnicode_Concat(module_dot, name);
22391 if (unlikely(!full_name)) { goto modbad; }
22392 #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\
22393 CYTHON_COMPILING_IN_GRAAL
22394 {
22395 PyObject *modules = PyImport_GetModuleDict();
22396 if (unlikely(!modules))
22397 goto modbad;
22398 value = PyObject_GetItem(modules, full_name);
22399 }
22400 #else
22401 value = PyImport_GetModule(full_name);
22402 #endif
22403 modbad:
22404 Py_XDECREF(full_name);
22405 Py_XDECREF(module_dot);
22406 Py_XDECREF(module_name);
22407 }
22408 if (unlikely(!value)) {
22409 PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
22410 }
22411 return value;
22412}
22413
22414/* dict_setdefault (used by FetchCommonType) */
22415static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {

Calls 1

Tested by

no test coverage detected