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 petr.viktorin
Recipients arigo, eric.snow, ncoghlan, petr.viktorin
Date 2019-03-04.10:42:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551696122.02.0.0501047351008.issue36124@roundup.psfhosted.org>
In-reply-to
Content
PyModule_GetState() gives you *per-module* state, not per-interpreter state.

Module objects are shared across subinterpreters, unless you use multi-phase initialization.

> PyModule_GetState() requires having the module object that corresponds
> to the given interpreter state.  I'm not sure how a C extension module
> is supposed to get its own module object corresponding to the current
> interpreter state, without getting it from the caller in some way.

This is the problem described in PEP 573: you don't always have access to your own module object. That keeps some more complex modules from switching to multi-phase init.

Unless this issue can wait for when PEP 580, PEP 573, and possibly some fallout of unknown unknowns are solved, let's add PyInterpreterState_GetDict for now.
History
Date User Action Args
2019-03-04 10:42:02petr.viktorinsetrecipients: + petr.viktorin, arigo, ncoghlan, eric.snow
2019-03-04 10:42:02petr.viktorinsetmessageid: <1551696122.02.0.0501047351008.issue36124@roundup.psfhosted.org>
2019-03-04 10:42:02petr.viktorinlinkissue36124 messages
2019-03-04 10:42:01petr.viktorincreate