On Mon, Feb 11, 2013 at 9:23 AM, Barry Warsaw <[email protected]> wrote:
> On Feb 11, 2013, at 09:23 PM, Nick Coghlan wrote: > > >On Mon, Feb 11, 2013 at 8:58 PM, Chris Withers <[email protected]> > 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. They are: http://docs.python.org/3.4/library/exceptions.html?highlight=importerror#ImportError > _not_found should not be since > it's an implementation detail. Yep, hence the leading underscore. > 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. > http://bugs.python.org/issue15767 Basically it's a matter of choosing ModuleNotFound vs. ModuleNotFoundError and then writing the code. -Brett > > 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 > _______________________________________________ > Python-Dev mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/brett%40python.org >
_______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
