mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #3080: imp.load_module() accepts None for the module path
imp.find_module() returns None as module path for builtin and frozen builtins.
This commit is contained in:
parent
6a1454f3a4
commit
6ae1e7f04e
2 changed files with 18 additions and 10 deletions
|
@ -229,7 +229,9 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
|
|||
i = ImpWrapper()
|
||||
sys.meta_path.append(i)
|
||||
sys.path_hooks.append(ImpWrapper)
|
||||
mnames = ("colorsys", "urllib.parse", "distutils.core")
|
||||
mnames = (
|
||||
"colorsys", "urllib.parse", "distutils.core", "sys",
|
||||
)
|
||||
for mname in mnames:
|
||||
parent = mname.split(".")[0]
|
||||
for n in list(sys.modules):
|
||||
|
@ -237,7 +239,8 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
|
|||
del sys.modules[n]
|
||||
for mname in mnames:
|
||||
m = __import__(mname, globals(), locals(), ["__dummy__"])
|
||||
m.__loader__ # to make sure we actually handled the import
|
||||
# to make sure we actually handled the import
|
||||
self.assertTrue(hasattr(m, "__loader__"))
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue