Kaydet (Commit) d94e558f authored tarafından Brett Cannon's avatar Brett Cannon

Move importlib's built-in importer to use rpartition for __package__.

üst eb2e0dd1
...@@ -115,7 +115,9 @@ class BuiltinImporter: ...@@ -115,7 +115,9 @@ class BuiltinImporter:
"""Load a built-in module.""" """Load a built-in module."""
if fullname not in sys.builtin_module_names: if fullname not in sys.builtin_module_names:
raise ImportError("{0} is not a built-in module".format(fullname)) 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: class FrozenImporter:
......
...@@ -15,7 +15,7 @@ class LoaderTests(abc.LoaderTests): ...@@ -15,7 +15,7 @@ class LoaderTests(abc.LoaderTests):
assert 'errno' in sys.builtin_module_names assert 'errno' in sys.builtin_module_names
name = 'errno' name = 'errno'
verification = {'__name__': 'errno', '__package__': None} verification = {'__name__': 'errno', '__package__': ''}
def verify(self, module): def verify(self, module):
"""Verify that the module matches against what it should have.""" """Verify that the module matches against what it should have."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment