mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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.
This commit is contained in:
parent
a2fedd8c91
commit
351c67416b
15 changed files with 189 additions and 121 deletions
|
@ -1021,11 +1021,11 @@ static void
|
|||
wrapper_dealloc(wrapperobject *wp)
|
||||
{
|
||||
PyObject_GC_UnTrack(wp);
|
||||
Py_TRASHCAN_SAFE_BEGIN(wp)
|
||||
Py_TRASHCAN_BEGIN(wp, wrapper_dealloc)
|
||||
Py_XDECREF(wp->descr);
|
||||
Py_XDECREF(wp->self);
|
||||
PyObject_GC_Del(wp);
|
||||
Py_TRASHCAN_SAFE_END(wp)
|
||||
Py_TRASHCAN_END
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue