Author eli.bendersky
Recipients Arfrever, Robin.Schreiber, asvetlov, effbot, eli.bendersky, pitrou
Date 2013-08-08.14:08:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAF-Rda971vhE6Pa2qP5ReoPD_XRXPY_q47_FwUS3=RRs0kwG4Q@mail.gmail.com>
In-reply-to <1510306418.50638959.1375970404276.JavaMail.root@zimbra10-e2.priv.proxad.net>
Content
On Thu, Aug 8, 2013 at 7:00 AM, Antoine Pitrou <report@bugs.python.org>wrote:

>
> Antoine Pitrou added the comment:
>
> > This code in the beginning in PyInit__elementtree:
> >
> >     m = PyState_FindModule(&elementtreemodule);
> >     if (m) {
> >         Py_INCREF(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.)
>
> I don't know :-) I just re-used Robin's original patch.
>

Would you mind removing it from the patch, due to the case described above?
ISTM that in real scenarios the sys.modules cache kicks in anyway. It
should not be really bypassed for any given sub-interpreter in sane code.

>
> > >> 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.
>
> Well, how to deal with module state should probably be better
> documented. Not sure how, though.
>

I'll think about it some more and will try to propose a documentation
patch. This can be done incrementally; we don't have to go to perfect docs
on the first try ;-)
History
Date User Action Args
2013-08-08 14:08:32eli.benderskysetrecipients: + eli.bendersky, effbot, pitrou, Arfrever, asvetlov, Robin.Schreiber
2013-08-08 14:08:32eli.benderskylinkissue15651 messages
2013-08-08 14:08:31eli.benderskycreate