summaryrefslogtreecommitdiff
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-08-24 14:55:17 +0900
committerGitHub <noreply@github.com>2017-08-24 14:55:17 +0900
commita6296d34a478b4f697ea9db798146195075d496c (patch)
tree6a26d56297f7d85dd6a8f18bca96e0c4ffb60802 /Modules/_struct.c
parentbf9075a0c55186d2f34df63e6c8512dd6414ff4b (diff)
downloadcpython-git-a6296d34a478b4f697ea9db798146195075d496c.tar.gz
bpo-31095: fix potential crash during GC (GH-2974)
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index b5fbc43564..69a1e996d0 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1589,6 +1589,8 @@ typedef struct {
static void
unpackiter_dealloc(unpackiterobject *self)
{
+ /* bpo-31095: UnTrack is needed before calling any callbacks */
+ PyObject_GC_UnTrack(self);
Py_XDECREF(self->so);
PyBuffer_Release(&self->buf);
PyObject_GC_Del(self);