diff options
| author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-05-10 19:21:11 +0200 |
|---|---|---|
| committer | Antoine Pitrou <antoine@python.org> | 2019-05-10 19:21:10 +0200 |
| commit | 351c67416ba4451eb3928fa0b2e933c2f25df1a3 (patch) | |
| tree | 5054fe93291fa93533ddd97622f329e96a31847e /Modules/_elementtree.c | |
| parent | a2fedd8c910cb5f5b9bd568d6fd44d63f8f5cfa5 (diff) | |
| download | cpython-git-351c67416ba4451eb3928fa0b2e933c2f25df1a3.tar.gz | |
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.
Diffstat (limited to 'Modules/_elementtree.c')
| -rw-r--r-- | Modules/_elementtree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index e9a0ea21b2..f5fc4437de 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -669,7 +669,7 @@ element_dealloc(ElementObject* self) { /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(self); - Py_TRASHCAN_SAFE_BEGIN(self) + Py_TRASHCAN_BEGIN(self, element_dealloc) if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); @@ -680,7 +680,7 @@ element_dealloc(ElementObject* self) RELEASE(sizeof(ElementObject), "destroy element"); Py_TYPE(self)->tp_free((PyObject *)self); - Py_TRASHCAN_SAFE_END(self) + Py_TRASHCAN_END } /* -------------------------------------------------------------------- */ |
