gh-102356: Add thrashcan macros to filter object dealloc (#102426)

Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters.
This commit is contained in:
Marta Gómez Macías 2023-03-05 12:00:41 +01:00 committed by GitHub
parent 5da379ca7d
commit 66aa78cbe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 0 deletions

View file

@ -553,9 +553,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