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 Robin.Schreiber
Recipients Robin.Schreiber, belopolsky, loewis
Date 2013-08-11.12:37:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I absolutely agree on mentioning the member names in the comments. :-)

In the example Martin gave in his PEP 3121, the PyInit does not perform any INCREFs on the Variables that are referenced from inside the module state.
He therefore left out m_free completely as there was nothing to DECREF within the module state.
Back when I did my GSoC together with Martin, we decided that the Module state itself can be considered a valid container object, an therefore has to INCREF and in the end of its lifecycle (that is within m_free) also DECREF every object reference it holds. I therefore decided to include that into every module I refactored, and consequently also the xxmodule.

I was also thinking about redefining the macro of xx_state_global with a NULL check, however this would lead either to a redundant call of PyState_FindModule (Which may lead to unnecessary performance degregation as xx_state_global is used quite frequently in some parts of the respective module) or I had to find some awkward way to store the result o f FindModule in some local variable exapnded by the macro, which I would not consider a good idea. Instead Martin and I were thinking of including a NULL safe variant of xx_state_global only in CPython Debug Builds. What do you think about that?
Date User Action Args
2013-08-11 12:37:10Robin.Schreibersetrecipients: + Robin.Schreiber, loewis, belopolsky
2013-08-11 12:37:10Robin.Schreibersetmessageid: <>
2013-08-11 12:37:10Robin.Schreiberlinkissue15849 messages
2013-08-11 12:37:09Robin.Schreibercreate