Nick Coghlan added the comment:

This is an interesting find - thanks.

Adding Larry as 3.5 release manager to the cc here, as I think the right fix 
actually involves an API adjustment inside _imp.

One of the consequences of PEP 489 (multi-phase initialisation) was that 
builtin imports and extension module imports now share a lot more code, and 
that includes the fact that while we have both _imp.create_builtin and 
_imp.create_dynamic, they currently share a module level exec implementation in 
_imp.exec_dynamic.

However, the definition and implementation of _imp.exec_dynamic is still behind 
the same preprocessor guard as _imp.create_dynamic, hence the error reported 
here.

As far as a fix goes, rather than defining _imp.exec_dynamic unconditionally, 
my inclination is to say that merging the Python level APIs in addition to the 
underyling C level implementation represents a design mistake when we 
implemented the PEP, and there should be a separate _imp.exec_builtin function.

The fact that _imp.exec_dynamic just called _imp.exec_builtin internally would 
then be a pure CPython implementation detail, rather than something importlib 
specifically depended on.

----------
nosy: +encukou

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

Reply via email to