From 351c67416ba4451eb3928fa0b2e933c2f25df1a3 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Fri, 10 May 2019 19:21:11 +0200 Subject: bpo-35983: skip trashcan for subclasses (GH-11841) Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer. --- Python/traceback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/traceback.c') diff --git a/Python/traceback.c b/Python/traceback.c index bd1061ed43..18bd0bf734 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -163,11 +163,11 @@ static void tb_dealloc(PyTracebackObject *tb) { PyObject_GC_UnTrack(tb); - Py_TRASHCAN_SAFE_BEGIN(tb) + Py_TRASHCAN_BEGIN(tb, tb_dealloc) Py_XDECREF(tb->tb_next); Py_XDECREF(tb->tb_frame); PyObject_GC_Del(tb); - Py_TRASHCAN_SAFE_END(tb) + Py_TRASHCAN_END } static int -- cgit v1.2.1