Eli Bendersky added the comment: On Thu, Aug 8, 2013 at 7:00 AM, Antoine Pitrou <rep...@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 ;-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15651> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com