]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111178: Fix _PyLegacyEventHandler_Type deallocator (#131193)
authorVictor Stinner <vstinner@python.org>
Fri, 14 Mar 2025 09:23:54 +0000 (10:23 +0100)
committerGitHub <noreply@github.com>
Fri, 14 Mar 2025 09:23:54 +0000 (10:23 +0100)
Don't use PyObject_Free() as tp_dealloc to avoid an undefined
behavior. Instead, use the default deallocator which just calls
tp_free which is PyObject_Free().

Python/legacy_tracing.c

index 82465c66ab5231a58b2895fcb9eadc970101034d..124b219ea8af97a5d83a676d78bf10356de2771e 100644 (file)
@@ -382,7 +382,6 @@ PyTypeObject _PyLegacyEventHandler_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "sys.legacy_event_handler",
     sizeof(_PyLegacyEventHandler),
-    .tp_dealloc = (destructor)PyObject_Free,
     .tp_vectorcall_offset = offsetof(_PyLegacyEventHandler, vectorcall),
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
         Py_TPFLAGS_HAVE_VECTORCALL | Py_TPFLAGS_DISALLOW_INSTANTIATION,