On Monday, January 9, 2017 at 4:45:19 PM UTC+1, Jean-Pierre Flori wrote:
>
> You can just use the Python "del" operator and Cython should translate it 
> to a destructor call.
>

No, there is the following caveat when cyclic Python references are 
involved:

__dealloc__ is always called, but there is no guarantee that pure Python 
attributes are still set (they may be cleared, that is, set to None, in 
order to break cycles). Cython (cdef) attributes are still set.

__del__ will not always be called, some garbage objects are skipped to 
break cycles. If __del__ is being called then all Python attributes are 
still set.

TLDR: use __dealloc__ to destroy wrapped C++ objects.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to