bpo-30876: Relative import from unloaded package now reimports the package (#2639)

instead of failing with SystemError.

Relative import from non-package now fails with ImportError rather than
SystemError.
This commit is contained in:
Serhiy Storchaka 2017-07-12 06:50:03 +03:00 committed by GitHub
parent 6d13b22e3a
commit 8a9cd20edc
8 changed files with 390 additions and 388 deletions

View file

@ -81,7 +81,7 @@ class Using__package__:
def test_bad__package__(self):
globals = {'__package__': '<not real>'}
with self.assertRaises(SystemError):
with self.assertRaises(ModuleNotFoundError):
self.__import__('', globals, {}, ['relimport'], 1)
def test_bunk__package__(self):