Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions 38 Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,43 +724,51 @@ module_repr(PyModuleObject *m)
int
_PyModuleSpec_IsInitializing(PyObject *spec)
{
if (spec != NULL) {
_Py_IDENTIFIER(_initializing);
PyObject *value = _PyObject_GetAttrId(spec, &PyId__initializing);
if (value != NULL) {
int initializing = PyObject_IsTrue(value);
Py_DECREF(value);
if (initializing >= 0) {
return initializing;
}
}
if (spec == NULL) {
goto exit;
}

_Py_IDENTIFIER(_initializing);
PyObject *value = _PyObject_GetAttrId(spec, &PyId__initializing);
if (value == NULL) {
goto exit;
}

int initializing = PyObject_IsTrue(value);
Py_DECREF(value);
if (initializing >= 0) {
return initializing;
}
exit:
PyErr_Clear();
return 0;
}

/* Check if the submodule name is in the "_uninitialized_submodules" attribute
of the module spec.
Clear the exception and return 0 if spec is NULL.
*/
int
_PyModuleSpec_IsUninitializedSubmodule(PyObject *spec, PyObject *name)
{
if (spec == NULL) {
return 0;
goto exit;
}

_Py_IDENTIFIER(_uninitialized_submodules);
PyObject *value = _PyObject_GetAttrId(spec, &PyId__uninitialized_submodules);
if (value == NULL) {
return 0;
goto exit;
}

int is_uninitialized = PySequence_Contains(value, name);
Py_DECREF(value);
if (is_uninitialized == -1) {
return 0;
if (is_uninitialized >= 0) {
return is_uninitialized;
}
return is_uninitialized;
exit:
PyErr_Clear();
return 0;
}

static PyObject*
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.