summaryrefslogtreecommitdiffstats
path: root/Modules/_functoolsmodule.c
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-09-04 03:31:41 (GMT)
committerGitHub <noreply@github.com>2017-09-04 03:31:41 (GMT)
commit4cde4bdcc86cb08ee3847500a172cc24eba37ffe (patch)
treecfc4c00f39f0cc6e9fec1e9756cf81c059ff9d6a /Modules/_functoolsmodule.c
parent990b2d043cdfaafc3378550f7d27259410a6b918 (diff)
downloadcpython-4cde4bdcc86cb08ee3847500a172cc24eba37ffe.zip
cpython-4cde4bdcc86cb08ee3847500a172cc24eba37ffe.tar.gz
cpython-4cde4bdcc86cb08ee3847500a172cc24eba37ffe.tar.bz2
bpo-31095: Fix potential crash during GC (GH-3197)
(cherry picked from commit a6296d34a478b4f697ea9db798146195075d496c)
Diffstat (limited to 'Modules/_functoolsmodule.c')
-rw-r--r--Modules/_functoolsmodule.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index e0781a9..e9e8933 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -143,6 +143,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
static void
partial_dealloc(partialobject *pto)
{
+ /* bpo-31095: UnTrack is needed before calling any callbacks */
PyObject_GC_UnTrack(pto);
if (pto->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) pto);