summaryrefslogtreecommitdiff
path: root/Modules/audioop.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-17 18:09:46 +0100
committerGitHub <noreply@github.com>2020-03-17 18:09:46 +0100
commit5b1ef200d31a74a9b478d0217d73ed0a659a8a06 (patch)
tree3a3afde33a456ac49284058c00b1d685c54bcf3c /Modules/audioop.c
parent52268941f37e3e27bd01792b081877ec3bc9ce12 (diff)
downloadcpython-git-5b1ef200d31a74a9b478d0217d73ed0a659a8a06.tar.gz
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>
Diffstat (limited to 'Modules/audioop.c')
-rw-r--r--Modules/audioop.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 467bd6362a..64cf98137c 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -1926,9 +1926,7 @@ static int
audioop_traverse(PyObject *module, visitproc visit, void *arg)
{
audioop_state *state = (audioop_state *)PyModule_GetState(module);
- if (state) {
- Py_VISIT(state->AudioopError);
- }
+ Py_VISIT(state->AudioopError);
return 0;
}
@@ -1936,9 +1934,7 @@ static int
audioop_clear(PyObject *module)
{
audioop_state *state = (audioop_state *)PyModule_GetState(module);
- if (state) {
- Py_CLEAR(state->AudioopError);
- }
+ Py_CLEAR(state->AudioopError);
return 0;
}