bpo-35414: Add a missing Py_INCREF(Py_None) in PyState_RemoveModule(). (GH-10914)
(cherry picked from commit 2a893430c9c8378cbdfac95895a64fa07aaff9ed)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
diff --git a/Python/pystate.c b/Python/pystate.c
index 15761e7..8077a3e 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -532,6 +532,7 @@
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);
}