Sept. 7, 2018
8:14 a.m.
On 2018-09-07 06:35, Stefan Behnel wrote:
Maybe you actually want "tp_finalize"?
https://www.python.org/dev/peps/pep-0442/
Cython moves "__del__" methods there in Py3.4+.
First of all, are you sure? I tried to cythonize cdef class X: def __del__(self): pass but the generated C code has static PyTypeObject __pyx_type_6cytest_X = { /* ... */ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; In any case, I want something which works with Python 2.7 too. Could we somehow call __del__ from tp_clear() in Python 2.7? Jeroen.