]> granicus.if.org Git - python/commit
Issue #15316: Let exceptions raised during imports triggered by the
authorBrett Cannon <brett@python.org>
Fri, 24 Aug 2012 22:25:59 +0000 (18:25 -0400)
committerBrett Cannon <brett@python.org>
Fri, 24 Aug 2012 22:25:59 +0000 (18:25 -0400)
commit12c6bda4f0e96c4bea285d8c664044753ea81bf1
tree8f7f0d38129542f4c8388c4ad20863ee9c457df9
parent7a54d16dc5684a2279bf3bd1e6bbb10c74c09850
Issue #15316: Let exceptions raised during imports triggered by the
fromlist of __import__ propagate.

The problem previously was that if something listed in fromlist didn't
exist then that's okay. The fix for that was too broad in terms of
catching ImportError.

The trick with the solution to this issue is that the proper
refactoring of import thanks to importlib doesn't allow for a way to
distinguish (portably) between an ImportError because finders couldn't
find a loader, or a loader raised the exception. In Python 3.4 the
hope is to introduce a new exception (e.g. ModuleNotFound) to make it
clean to differentiate why ImportError was raised.
Lib/importlib/_bootstrap.py
Lib/test/test_importlib/import_/test_api.py
Misc/NEWS
Python/importlib.h