From eb4b6042b023b1afabc439c63275ad720215803a Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Wed, 5 Dec 2018 00:14:00 -0700 Subject: [PATCH] bpo-35414: Add a missing Py_INCREF(Py_None) in PyState_RemoveModule(). (GH-10914) (cherry picked from commit 2a893430c9c8378cbdfac95895a64fa07aaff9ed) Co-authored-by: Zackery Spytz --- Python/pystate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/pystate.c b/Python/pystate.c index c0e088055a60fc0..71494daa471a269 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -377,6 +377,7 @@ PyState_RemoveModule(struct PyModuleDef* def) Py_FatalError("PyState_RemoveModule: Module index out of bounds."); return -1; } + Py_INCREF(Py_None); return PyList_SetItem(state->modules_by_index, index, Py_None); }