diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-08-10 16:59:36 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-08-10 16:59:36 (GMT) |
commit | 056bafe7a663e890594a11eec99c78f742452fff (patch) | |
tree | 0982dd869f5febfca0088f0104ae5745cebc7324 /Lib/test | |
parent | a9e67ad993f672b44341a110f4a71b746dd066bf (diff) | |
download | cpython-056bafe7a663e890594a11eec99c78f742452fff.zip cpython-056bafe7a663e890594a11eec99c78f742452fff.tar.gz cpython-056bafe7a663e890594a11eec99c78f742452fff.tar.bz2 |
#18681: Fix a NameError in imp.reload() (noticed by Weizhao Li).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_imp.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index fe436f3..ade3e25 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.""" |