diff options
| author | Brett Cannon <brett@python.org> | 2012-10-10 19:18:37 -0400 |
|---|---|---|
| committer | Brett Cannon <brett@python.org> | 2012-10-10 19:18:37 -0400 |
| commit | 748f86035b64fc90101e403f49a1f06cd2f09045 (patch) | |
| tree | 85f1a04d05e365054a9444161648cadca7ec23d5 /Lib/importlib/_bootstrap.py | |
| parent | aafdd80ece87e0bd78e9921c59e59fb224bca1b5 (diff) | |
| parent | 67e4b3c60d325ef37e8fa05d5f39b7ed55a3cf50 (diff) | |
| download | cpython-748f86035b64fc90101e403f49a1f06cd2f09045.tar.gz | |
Merge fix for issue #15111.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
| -rw-r--r-- | Lib/importlib/_bootstrap.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index fd86737873..e26cd264ac 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -1602,19 +1602,19 @@ def _handle_fromlist(module, fromlist, import_): fromlist.extend(module.__all__) for x in fromlist: if not hasattr(module, x): + from_name = '{}.{}'.format(module.__name__, x) try: - _call_with_frames_removed(import_, - '{}.{}'.format(module.__name__, x)) + _call_with_frames_removed(import_, from_name) except ImportError as exc: # Backwards-compatibility dictates we ignore failed # imports triggered by fromlist for modules that don't # exist. # TODO(brett): In Python 3.4, have import raise # ModuleNotFound and catch that. - if hasattr(exc, '_not_found') and exc._not_found: - pass - else: - raise + if getattr(exc, '_not_found', False): + if exc.name == from_name: + continue + raise return module |
