[Python-3000] PEP 3121 implemented
Stefan Behnel
stefan_ml at behnel.de
Thu Aug 7 22:48:51 CEST 2008
Greg Ewing wrote:
> Martin v. Löwis wrote:
>
>> However, _sre relied on the module already being in
>> sys.modules, as it runs Python code in the init function that already
>> imports the module being initialized.
>
> This issue also potentially affects all Pyrex and Cython
> generated modules, which must be free to execute arbitrary
> Python code during initialisation, including imports.
As I understand this, the problem only relates to importing the module being
initialised, which a module won't do for itself. But I can well imagine the
case that a third module that gets imported during the init phase happens to
import the initialising module, i.e. a transitive re-import.
Martin, talking about correctness, I would also expect the import code to
prevent an infinite import loop here (or whatever the problem for _sre was).
Stefan
More information about the Python-3000
mailing list