mirror of
https://github.com/python/cpython.git
synced 2026-04-15 08:11:10 +00:00
gh-145059: Record lazy modules without submodules in sys.lazy_modules (#146081)
Record simple lazy modules as well
This commit is contained in:
parent
69b08c397b
commit
a5b9d60a69
3 changed files with 22 additions and 0 deletions
|
|
@ -4377,6 +4377,12 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name,
|
|||
Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0,
|
||||
PyUnicode_GET_LENGTH(name), -1);
|
||||
if (dot < 0) {
|
||||
PyObject *lazy_submodules = ensure_lazy_submodules(
|
||||
(PyDictObject *)lazy_modules, name);
|
||||
if (lazy_submodules == NULL) {
|
||||
goto done;
|
||||
}
|
||||
Py_DECREF(lazy_submodules);
|
||||
ret = 0;
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue