summaryrefslogtreecommitdiffstats
path: root/Lib/imputil.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-04 05:08:10 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-04 05:08:10 (GMT)
commit61d168a55ed08de951c69213a47896f637306908 (patch)
treef1bf47b10062140079af5ae189d5258667c98c5a /Lib/imputil.py
parent14f3da7585b32fe0fd1367bf5ada1e5aeb6f1f0e (diff)
downloadcpython-61d168a55ed08de951c69213a47896f637306908.zip
cpython-61d168a55ed08de951c69213a47896f637306908.tar.gz
cpython-61d168a55ed08de951c69213a47896f637306908.tar.bz2
Bug #1481530: allow "from os.path import ..." with imputil
Diffstat (limited to 'Lib/imputil.py')
-rw-r--r--Lib/imputil.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/imputil.py b/Lib/imputil.py
index e6ad7ec..8a49bb1 100644
--- a/Lib/imputil.py
+++ b/Lib/imputil.py
@@ -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