diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:14:04 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:14:04 (GMT) |
commit | 98a9722e4a82b5f7dc0411233bbec892a02c7667 (patch) | |
tree | 51179bb7d80e822a18d0ccbb41fde7198f424813 /Modules/flmodule.c | |
parent | 2cfae9b03f706e0d6889dfecc21f87419d926b00 (diff) | |
download | cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.zip cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.tar.gz cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.tar.bz2 |
Issue #20437: Fixed 43 potential bugs when deleting objects references.
Diffstat (limited to 'Modules/flmodule.c')
-rw-r--r-- | Modules/flmodule.c | 12 |
1 files changed, 4 insertions, 8 deletions
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 @@ forgetgeneric(genericobject *g) { 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 @@ releaseobjects(FL_FORM *form) /* 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++; } |