summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-03-05 11:20:41 (GMT)
committerGitHub <noreply@github.com>2023-03-05 11:20:41 (GMT)
commitd4a04e55d8bd8eaa307f3e4aa8b443301a0d996a (patch)
treeebf345b79cb8ef303c61a6d23624454311e8ffc6 /Python
parentd4992c7315c1b92a73eec30407ed0cf3b673194a (diff)
downloadcpython-d4a04e55d8bd8eaa307f3e4aa8b443301a0d996a.zip
cpython-d4a04e55d8bd8eaa307f3e4aa8b443301a0d996a.tar.gz
cpython-d4a04e55d8bd8eaa307f3e4aa8b443301a0d996a.tar.bz2
gh-102356: Add thrashcan macros to filter object dealloc (GH-102426)
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 <mgmacias@google.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 659b78e..6ea20bf 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -567,9 +567,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