Issue #20437: Fixed 43 potential bugs when deleting objects references.
diff --git a/Modules/flmodule.c b/Modules/flmodule.c
index b5a78cf..0ddf600 100644
--- a/Modules/flmodule.c
+++ b/Modules/flmodule.c
@@ -97,10 +97,8 @@
{
int i, n;
- Py_XDECREF(g->ob_callback);
- g->ob_callback = NULL;
- Py_XDECREF(g->ob_callback_arg);
- g->ob_callback_arg = NULL;
+ Py_CLEAR(g->ob_callback);
+ Py_CLEAR(g->ob_callback_arg);
if (allgenerics == NULL)
return; /* No objects known yet */
n = PyList_Size(allgenerics);
@@ -132,10 +130,8 @@
/* The object is now unreachable for
do_forms and check_forms, so
delete it from the list of known objects */
- Py_XDECREF(g->ob_callback);
- g->ob_callback = NULL;
- Py_XDECREF(g->ob_callback_arg);
- g->ob_callback_arg = NULL;
+ Py_CLEAR(g->ob_callback);
+ Py_CLEAR(g->ob_callback_arg);
PyList_SetItem(allgenerics, i, (PyObject *)NULL);
nfreeslots++;
}