Author brett.cannon
Recipients Arfrever, Guido.van.Rossum, asvetlov, barry, brett.cannon, chris.jerdonek, cvrebert, eric.snow, ezio.melotti, gvanrossum, pitrou, python-dev, serhiy.storchaka, theller
Date 2013-07-02.14:26:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1372775217.28.0.469727212699.issue15767@psf.upfronthosting.co.za>
In-reply-to
Content
OK, I'll revert the changes related to ModuleNotFoundError.

As for adding a 'reason' attribute, I see two sticking points. One is how to set the enum value. There is both the C code issue (specifically so ceval.c and import.c can use the values) as well as importlib's bootstrapping restrictions. I'll have to think about whether there is any reasonable way to make it work.

Second, as you hinted at Guido, is exactly what the acceptable cases may be. I would probably start with any ImportError raised directly by import itself and nothing more. Other things from loaders (e.g. bad magic number, stale bytecode, etc.) could be initially left out. That would mean the following possible values:

* module is not a package
* module not found
* None in sys.modules

But the bootstrapping issues for the enum module is probably going to be the showstopper for this. That suggests either adding not_found or figuring out some way to prevent _not_found from leaking outside of importlib (which I now think I can do somewhat reasonably).
History
Date User Action Args
2013-07-02 14:26:57brett.cannonsetrecipients: + brett.cannon, gvanrossum, barry, theller, pitrou, ezio.melotti, Arfrever, cvrebert, asvetlov, chris.jerdonek, python-dev, eric.snow, serhiy.storchaka, Guido.van.Rossum
2013-07-02 14:26:57brett.cannonsetmessageid: <1372775217.28.0.469727212699.issue15767@psf.upfronthosting.co.za>
2013-07-02 14:26:57brett.cannonlinkissue15767 messages
2013-07-02 14:26:56brett.cannoncreate