Brett Cannon added the comment:

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).

----------
resolution: fixed -> 
stage: committed/rejected -> 

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15767>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to