summaryrefslogtreecommitdiff
path: root/Modules/_io
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-09-04 12:31:41 +0900
committerGitHub <noreply@github.com>2017-09-04 12:31:41 +0900
commit4cde4bdcc86cb08ee3847500a172cc24eba37ffe (patch)
treecfc4c00f39f0cc6e9fec1e9756cf81c059ff9d6a /Modules/_io
parent990b2d043cdfaafc3378550f7d27259410a6b918 (diff)
downloadcpython-git-4cde4bdcc86cb08ee3847500a172cc24eba37ffe.tar.gz
bpo-31095: Fix potential crash during GC (GH-3197)
(cherry picked from commit a6296d34a478b4f697ea9db798146195075d496c)
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/bytesio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 1335ae8903..0ee4b80434 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -745,6 +745,7 @@ bytesio_setstate(bytesio *self, PyObject *state)
static void
bytesio_dealloc(bytesio *self)
{
+ /* bpo-31095: UnTrack is needed before calling any callbacks */
_PyObject_GC_UNTRACK(self);
if (self->buf != NULL) {
PyMem_Free(self->buf);