[Python-checkins] cpython (merge 3.3 -> default): #18681: merge with 3.3.

ezio.melotti python-checkins at python.org
Sat Aug 10 19:02:46 CEST 2013


http://hg.python.org/cpython/rev/6bee7f1061e0
changeset: 85102:6bee7f1061e0
parent: 85100:8215bc8ab617
parent: 85101:80b65aa2d579
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Sat Aug 10 20:01:43 2013 +0300
summary:
 #18681: merge with 3.3.
files:
 Lib/importlib/__init__.py | 2 +-
 Lib/test/test_imp.py | 9 +++++++++
 Misc/NEWS | 2 ++
 3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -115,7 +115,7 @@
 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:
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -314,6 +314,15 @@
 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."""
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -221,6 +221,8 @@
 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.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /