From 63fd95410038d1333da8b514adffdd0f4736aa27 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 5 Mar 2023 03:25:48 -0800 Subject: gh-102356: Add thrashcan macros to filter object dealloc (GH-102426) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters. (cherry picked from commit 66aa78cbe604a7c5731f074b869f92174a8e3b64) Co-authored-by: Marta Gómez Macías --- Python/bltinmodule.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index a3fdb394a13..6c8725f9823 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -556,9 +556,11 @@ static void filter_dealloc(filterobject *lz) { PyObject_GC_UnTrack(lz); + Py_TRASHCAN_BEGIN(lz, filter_dealloc) Py_XDECREF(lz->func); Py_XDECREF(lz->it); Py_TYPE(lz)->tp_free(lz); + Py_TRASHCAN_END } static int -- cgit v1.3.1