On Feb 11, 2013, at 09:23 PM, Nick Coghlan wrote:
On Mon, Feb 11, 2013 at 8:58 PM, Chris Withers <chris@simplistix.co.uk> wrote:
Have any other exceptions grown new attributes in Python 3?
Off the top of my head, ImportError grew "name" and "path" attributes in 3.3, everything grew __cause__, __context__ and __traceback__ attributes in 3.0 and the __suppress_context__ attribute in 3.3.
PEP 3151 may have moved a few attributes around in 3.3 as well.
If there are any others, you'll need to trawl the What's New documents looking for them.
Those public attributes should be documented. _not_found should not be since it's an implementation detail. Also, Brett has left little TODO easter eggs in the code which clearly indicate changes he plans for 3.4, although I don't know where the plans for ModuleNotFound are documented. In the meantime, I just ran a test against trunk, with the following change and nothing broke afaict. diff -r a79650aacb43 Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py Mon Feb 11 13:33:00 2013 +0000 +++ b/Lib/importlib/_bootstrap.py Mon Feb 11 09:16:51 2013 -0500 @@ -1640,6 +1640,7 @@ # TODO(brett): In Python 3.4, have import raise # ModuleNotFound and catch that. if getattr(exc, '_not_found', False): + del exc._not_found if exc.name == from_name: continue raise I won't commit this, but it really needs another hasattr() check to be completely valid. Cheers, -Barry