summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-07-16 04:44:25 (GMT)
committerGitHub <noreply@github.com>2017-07-16 04:44:25 (GMT)
commit28343e3392ca7b1ec7151f68d4d92c90efb91e50 (patch)
treebb3e51c35c23b66403fbf7460c9e595b3fa5368e /Lib/importlib
parent65de1f3672fd0a1e3ec34b654ef5213e15a03e26 (diff)
downloadcpython-28343e3392ca7b1ec7151f68d4d92c90efb91e50.zip
cpython-28343e3392ca7b1ec7151f68d4d92c90efb91e50.tar.gz
cpython-28343e3392ca7b1ec7151f68d4d92c90efb91e50.tar.bz2
[3.6] bpo-30876: Relative import from unloaded package now reimports the package (GH-2639) (#2676)
instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError. (cherry picked from commit 8a9cd20edca7d01b68292036029ae3735ce65edd)
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py4
1 files changed, 0 insertions, 4 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index f7790c1..bf13e2a 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')