]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)
authorVictor Stinner <vstinner@python.org>
Tue, 17 Mar 2020 17:09:46 +0000 (18:09 +0100)
committerGitHub <noreply@github.com>
Tue, 17 Mar 2020 17:09:46 +0000 (18:09 +0100)
commit5b1ef200d31a74a9b478d0217d73ed0a659a8a06
tree3a3afde33a456ac49284058c00b1d685c54bcf3c
parent52268941f37e3e27bd01792b081877ec3bc9ce12
bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)

Extension modules: m_traverse, m_clear and m_free functions of
PyModuleDef are no longer called if the module state was requested
but is not allocated yet. This is the case immediately after the
module is created and before the module is executed (Py_mod_exec
function). More precisely, these functions are not called if m_size is
greater than 0 and the module state (as returned by
PyModule_GetState()) is NULL.

Extension modules without module state (m_size <= 0) are not affected.

Co-Authored-By: Petr Viktorin <encukou@gmail.com>
Doc/c-api/module.rst
Doc/whatsnew/3.9.rst
Lib/test/test_importlib/extension/test_loader.py
Misc/NEWS.d/next/C API/2020-03-02-11-29-45.bpo-39824.71_ZMn.rst [new file with mode: 0644]
Modules/_localemodule.c
Modules/_testmultiphase.c
Modules/atexitmodule.c
Modules/audioop.c
Modules/binascii.c
Objects/moduleobject.c