diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-07-12 03:50:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-12 03:50:03 (GMT) |
commit | 8a9cd20edca7d01b68292036029ae3735ce65edd (patch) | |
tree | f4df7b29b7d32eb5a860e325f2114beea561e57b /Lib/importlib | |
parent | 6d13b22e3ab262c6b1f068259aebd705e7da316c (diff) | |
download | cpython-8a9cd20edca7d01b68292036029ae3735ce65edd.zip cpython-8a9cd20edca7d01b68292036029ae3735ce65edd.tar.gz cpython-8a9cd20edca7d01b68292036029ae3735ce65edd.tar.bz2 |
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.
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 21e8c4b..a269eee 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -919,10 +919,6 @@ def _sanity_check(name, package, level): elif not package: raise ImportError('attempted relative import with no known parent ' 'package') - elif package not in sys.modules: - msg = ('Parent module {!r} not loaded, cannot perform relative ' - 'import') - raise SystemError(msg.format(package)) if not name and level == 0: raise ValueError('Empty module name') |