Author eli.bendersky
Recipients Arfrever, Robin.Schreiber, asvetlov, effbot, eli.bendersky, pitrou
Date 2013-08-08.13:56:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Thanks Antoine. I think I understand the patch better now. Just a couple small questions and otherwise LGTM

This code in the beginning in PyInit__elementtree:

    m = PyState_FindModule(&elementtreemodule);
    if (m) {
        return m;

Can you explain what use case it tries to cover? I couldn't find similar code in other modules we have that implement PEP 3121 (_csv, readline, io, etc.)

This code has at least one adverse effect, for testing. The problem with re-importing _elementtree I raised in is solved by moving to PEP 3121, but this piece of code above ruins it. This is because I want to set sys.modules['pyexpat'] = None and re-import _elementtree (this is what support.import_fresh_module does). But with this code in place, if _elementtree was imported any time in the past (say, in a previous test), I'll just get the instance back without attempting to do the full module initialization.

>> I don't see a call to PyState_AddModule. What am I missing?
>It is called implicitly when an extension module is imported.

Do you think this should be documented in the C API docs? The way they read now, it seems that calling PyState_AddModule is needed manually by extension writers.
Date User Action Args
2013-08-08 13:56:34eli.benderskysetrecipients: + eli.bendersky, effbot, pitrou, Arfrever, asvetlov, Robin.Schreiber
2013-08-08 13:56:34eli.benderskysetmessageid: <>
2013-08-08 13:56:34eli.benderskylinkissue15651 messages
2013-08-08 13:56:34eli.benderskycreate