mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Bug #1481530: allow "from os.path import ..." with imputil
This commit is contained in:
parent
14f3da7585
commit
61d168a55e
1 changed files with 5 additions and 2 deletions
|
@ -131,9 +131,12 @@ class ImportManager:
|
|||
if importer:
|
||||
return importer._finish_import(top_module, parts[1:], fromlist)
|
||||
|
||||
# Grrr, some people "import os.path"
|
||||
# Grrr, some people "import os.path" or do "from os.path import ..."
|
||||
if len(parts) == 2 and hasattr(top_module, parts[1]):
|
||||
return top_module
|
||||
if fromlist:
|
||||
return getattr(top_module, parts[1])
|
||||
else:
|
||||
return top_module
|
||||
|
||||
# If the importer does not exist, then we have to bail. A missing
|
||||
# importer means that something else imported the module, and we have
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue