Nick Coghlan added the comment:

My concern is more about backwards compatibility - at the moment, you can alter 
the behaviour of import, pickle, and other subsystems by modifying the module 
level attributes, and if we switch to preferring the __spec__ attributes, then 
that kind of code will break (I added an import specific example related to 
__main__ module relative imports to the linked issue).

That's not to say it shouldn't be done - as you say, it would be nice to 
eventually get to a point where the import system only needs access to the 
module spec and not to the runtime state, and there are also cases where the 
__spec__ information will be more correct (e.g. pickling objects in __main__).

However, it needs to be in such a way that there are appropriate porting notes 
that explain to people why their state mutations stopped having the desired 
effect, and what (if anything) they can do instead.

----------

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

Reply via email to