[New-bugs-announce] [issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

Bradley Froehle report at bugs.python.org
Fri Feb 8 19:27:15 CET 2013

New submission from Bradley Froehle:

I tried to implement a custom extension type using PyType_FromSpec and Py_LIMITED_API but couldn't implement tp_dealloc:

static void mytype_dealloc(mytypeobject *self)
    // free some fields in mytypeobject
    Py_TYPE(self)->tp_free((PyObject *) self); // XXX

The line marked XXX will not compile in Py_LIMITED_API because there is no access to the fields of PyTypeObject.  There doesn't seem to be any function in the API which just calls tp_free.

I suggest the addition of an API function (to be included in Py_LIMITED_API):

PyType_GenericDealloc(PyObject *self)

messages: 181689
nosy: bfroehle
priority: normal
severity: normal
status: open
title: Py_LIMITED_API needs a PyType_GenericDealloc
type: enhancement
versions: Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list