[Python-Dev] _not_found attribute on ImportError

Nick Coghlan ncoghlan at gmail.com
Mon Feb 11 11:54:26 CET 2013


On Mon, Feb 11, 2013 at 6:08 PM, Chris Withers <chris at simplistix.co.uk> wrote:
> Hi All,
>
> I see in Python 3, some ImportErrors have grown a '_not_found' attribute.
> What's the significance of this attribute and where/how is it added?
>
> The only way I can seem to create this attribute is:
>
> ex = ImportError
> ex._not_found = True

It's something importlib does to get fromlists to behave the same way
they did in the C implementation.

It is set here:
http://hg.python.org/cpython/file/3.3/Lib/importlib/_bootstrap.py
To make these pass:
http://hg.python.org/cpython/file/3.3/Lib/test/test_importlib/import_/test_fromlist.py

You'd have to ask Brett which specific test is affected, or else you
could comment out the line that sets _not_found and see what breaks
(you may need to refreeze _frozen_importlib first).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list