Commit 29889e5b authored by Ezio Melotti's avatar Ezio Melotti

#18681: merge with 3.3.

parents 3f3acbd6 f2d0e053
......@@ -115,7 +115,7 @@ def reload(module):
parent_name = name.rpartition('.')[0]
if parent_name and parent_name not in sys.modules:
msg = "parent {!r} not in sys.modules"
raise ImportError(msg.format(parentname), name=parent_name)
raise ImportError(msg.format(parent_name), name=parent_name)
return module.__loader__.load_module(name)
finally:
try:
......
......@@ -314,6 +314,15 @@ class ReloadTests(unittest.TestCase):
import marshal
imp.reload(marshal)
def test_with_deleted_parent(self):
# see #18681
from html import parser
del sys.modules['html']
def cleanup(): del sys.modules['html.parser']
self.addCleanup(cleanup)
with self.assertRaisesRegex(ImportError, 'html'):
imp.reload(parser)
class PEP3147Tests(unittest.TestCase):
"""Tests of PEP 3147."""
......
......@@ -221,6 +221,8 @@ Core and Builtins
Library
-------
- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li).
- Issue #14323: Expanded the number of digits in the coefficients for the
RGB -- YIQ conversions so that they match the FCC NTSC versions.
......
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