Re: [Cython] Hooking tp_clear()

2018-09-06 Thread Greg Ewing
Jeroen Demeyer wrote: I have a concrete use case where I want something like __dealloc__ but > *before* Python attributes are cleared. So this really belongs in tp_clear(). Are you sure you can't do it in __del__? From what I gather, the presence of __del__ no longer prevents cyclic garbage c

Re: [Cython] Hooking tp_clear()

2018-09-06 Thread Stefan Behnel
Jeroen Demeyer schrieb am 06.09.2018 um 22:54: > Cython's __dealloc__ special method is meant to deal with cleaning up > instances of cdef classes. However, this hooks tp_dealloc() and does not > have meaningful access to Python attributes, since those might have been > cleared by tp_clear(). > >

[Cython] Hooking tp_clear()

2018-09-06 Thread Jeroen Demeyer
Hello, Cython's __dealloc__ special method is meant to deal with cleaning up instances of cdef classes. However, this hooks tp_dealloc() and does not have meaningful access to Python attributes, since those might have been cleared by tp_clear(). I have a concrete use case where I want someth