summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-02-07 01:40:19 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-02-07 01:40:19 (GMT)
commitd94e558fdc58d0a15545e858cc47eabe7ee7f38d (patch)
tree740e6ff2dd2de6cdc133000e661f3d688dda31e2 /Lib/importlib
parenteb2e0dd19d0003faf3366d648cb11d8c7218ed73 (diff)
downloadcpython-d94e558fdc58d0a15545e858cc47eabe7ee7f38d.zip
cpython-d94e558fdc58d0a15545e858cc47eabe7ee7f38d.tar.gz
cpython-d94e558fdc58d0a15545e858cc47eabe7ee7f38d.tar.bz2
Move importlib's built-in importer to use rpartition for __package__.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py4
-rw-r--r--Lib/importlib/test/builtin/test_loader.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 99fb236..bc50036 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -115,7 +115,9 @@ class BuiltinImporter:
"""Load a built-in module."""
if fullname not in sys.builtin_module_names:
raise ImportError("{0} is not a built-in module".format(fullname))
- return imp.init_builtin(fullname)
+ module = imp.init_builtin(fullname)
+ module.__package__ = ''
+ return module
class FrozenImporter:
diff --git a/Lib/importlib/test/builtin/test_loader.py b/Lib/importlib/test/builtin/test_loader.py
index 940529e..1171960 100644
--- a/Lib/importlib/test/builtin/test_loader.py
+++ b/Lib/importlib/test/builtin/test_loader.py
@@ -15,7 +15,7 @@ class LoaderTests(abc.LoaderTests):
assert 'errno' in sys.builtin_module_names
name = 'errno'
- verification = {'__name__': 'errno', '__package__': None}
+ verification = {'__name__': 'errno', '__package__': ''}
def verify(self, module):
"""Verify that the module matches against what it should have."""