From 056bafe7a663e890594a11eec99c78f742452fff Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Sat, 10 Aug 2013 19:59:36 +0300 Subject: #18681: Fix a NameError in imp.reload() (noticed by Weizhao Li). --- Lib/test/test_imp.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Lib/test/test_imp.py') diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index fe436f3985..ade3e2564f 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -275,6 +275,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.""" -- cgit v1.2.1