[New-bugs-announce] [issue41073] [C API] PyType_GetSlot() should accept static types

STINNER Victor report at bugs.python.org
Mon Jun 22 04:38:14 EDT 2020

New submission from STINNER Victor <vstinner at python.org>:

To fix bpo-40170, I would like to modify Py_TRASHCAN_BEGIN() macro to use PyType_GetSlot() to get the deallocator function, rather than accessing directly the PyTypeObject.tp_dealloc member. The problem is that currently PyType_GetSlot() only works on heap allocated types.

Would it be possible to add support for statically allocated types to PyType_GetSlot()?

Py_TRASHCAN_BEGIN() is currently defined as:

#define Py_TRASHCAN_BEGIN(op, dealloc) \
        Py_TYPE(op)->tp_dealloc == (destructor)(dealloc))

components: C API
messages: 372049
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] PyType_GetSlot() should accept static types
versions: Python 3.10

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list