mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Move importlib's built-in importer to use rpartition for __package__.
This commit is contained in:
parent
eb2e0dd19d
commit
d94e558fdc
2 changed files with 4 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue