mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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 66aa78cbe6
)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
This commit is contained in:
parent
d4992c7315
commit
d4a04e55d8
4 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue