diff options
author | Brett Cannon <brett@python.org> | 2014-10-10 14:54:28 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-10-10 14:54:28 (GMT) |
commit | 5e8b04eefb08828dde5b609efc7e1430244a6ae3 (patch) | |
tree | 65958415d74b5839b3ca852d515af157a10456d0 /Lib/importlib/_bootstrap.py | |
parent | 1aa3cb60304fafc6285c34172dd411ced672664e (diff) | |
download | cpython-5e8b04eefb08828dde5b609efc7e1430244a6ae3.zip cpython-5e8b04eefb08828dde5b609efc7e1430244a6ae3.tar.gz cpython-5e8b04eefb08828dde5b609efc7e1430244a6ae3.tar.bz2 |
Issue #21052: Don't raise ImportWarning for sys.meta_path or
sys.path_hooks when set to None during interpreter shutdown.
Thanks to Martin Panter for the initial bug report.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index c4ee41a..b47ffad 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -1806,7 +1806,7 @@ class PathFinder: If 'hooks' is false then use sys.path_hooks. """ - if not sys.path_hooks: + if sys.path_hooks is not None and not sys.path_hooks: _warnings.warn('sys.path_hooks is empty', ImportWarning) for hook in sys.path_hooks: try: @@ -2095,7 +2095,7 @@ def _find_spec_legacy(finder, name, path): def _find_spec(name, path, target=None): """Find a module's loader.""" - if not sys.meta_path: + if sys.meta_path is not None and not sys.meta_path: _warnings.warn('sys.meta_path is empty', ImportWarning) # We check sys.modules here for the reload case. While a passed-in # target will usually indicate a reload there is no guarantee, whereas |