summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-09-26 21:24:16 (GMT)
committerlarryhastings <larry@hastings.org>2017-09-26 21:24:16 (GMT)
commit0fcc03367b31f44c1e1b8d3d2dd940ef1e744326 (patch)
treee889a3b7de22ace9191e6b9ffd45093e897a3384 /Python
parent44c1b62939a6192776dc9d093546154044cb2ecb (diff)
downloadcpython-0fcc03367b31f44c1e1b8d3d2dd940ef1e744326.zip
cpython-0fcc03367b31f44c1e1b8d3d2dd940ef1e744326.tar.gz
cpython-0fcc03367b31f44c1e1b8d3d2dd940ef1e744326.tar.bz2
bpo-31095: fix potential crash during GC (GH-2974) (#3196)
(cherry picked from commit a6296d34a478b4f697ea9db798146195075d496c)
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index ad53ba35..d7586f2 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -486,6 +486,8 @@ typedef struct {
static void
ast_dealloc(AST_object *self)
{
+ /* bpo-31095: UnTrack is needed before calling any callbacks */
+ PyObject_GC_UnTrack(self);
Py_CLEAR(self->dict);
Py_TYPE(self)->tp_free(self);
}