mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
bpo-30024: Circular imports involving absolute imports with binding (#1264)
a submodule to a name are now supported.
This commit is contained in:
parent
dbdea629e2
commit
f93234bb8a
6 changed files with 17 additions and 2 deletions
|
@ -2546,7 +2546,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
|
|||
merely needs to bind the result to a name.
|
||||
|
||||
If there is a dot in name, we need to split it and emit a
|
||||
LOAD_ATTR for each name.
|
||||
IMPORT_FROM for each name.
|
||||
*/
|
||||
Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0,
|
||||
PyUnicode_GET_LENGTH(name), 1);
|
||||
|
@ -2566,7 +2566,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
|
|||
PyUnicode_GET_LENGTH(name));
|
||||
if (!attr)
|
||||
return 0;
|
||||
ADDOP_O(c, LOAD_ATTR, attr, names);
|
||||
ADDOP_O(c, IMPORT_FROM, attr, names);
|
||||
Py_DECREF(attr);
|
||||
pos = dot + 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue