This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients Arfrever, brett.cannon, eric.snow, georg.brandl, meador.inge, scoder
Date 2012-08-17.19:51:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345233082.05.0.234436927977.issue15623@psf.upfronthosting.co.za>
In-reply-to
Content
So I can't reproduce under 3.2. First off, building the example code in test.tgz fails thanks to __Py_ZeroStruct not being found (this is with using both an installed Python 3.2 and a checkout build).

Second, when I just make audioop a package in Python 3.2 it still grabs the __init__.py file, so I can't reproduce that way either.

Third, I hand-traced the import code starting in load_module() in Python 3.2 and if you follow::

  import.c:load_module() ->
  importdl.c:_PyImport_GetDynLoadFunc() ->
  import.c:_PyImport_FixupExtensionUnicode()

you will find where a new module gets set in sys.modules (through PyImport_GetModuleDict()) and it's after the PyInit function for the extension module is called. So if there is some magical path that is deep in import.c that is setting the module in sys.modules when there is a __init__.py next to an __init__.so I will need someone who has actually made this work with an empty __init__.py figure out how it's all happening since _PyImport_GetDynLoadFunc() would short-circuit if the module was already in sys.modules and entirely skip executing the PyInit for the extension module.

Fourth, if you go with the work-around, Stefan, just make sure that on error anywhere in your PyInit you remove the module from sys.modules that you injected.

Because of all of this I am making this pending as "won't fix". If someone can figure out what is happening in Python 3.2 I will leave it open until we decide how to handle this, else I will close this before rc1.
History
Date User Action Args
2012-08-17 19:51:22brett.cannonsetrecipients: + brett.cannon, georg.brandl, scoder, Arfrever, meador.inge, eric.snow
2012-08-17 19:51:22brett.cannonsetmessageid: <1345233082.05.0.234436927977.issue15623@psf.upfronthosting.co.za>
2012-08-17 19:51:21brett.cannonlinkissue15623 messages
2012-08-17 19:51:21brett.cannoncreate