Hi Pau,

Also, the Cython documentation warns against doing this kind of things
(here, accessing the Python object stored in ``foo``).  From
https://cython.readthedocs.io/en/latest/src/userguide/special_methods.html:

    You need to be careful what you do in a __dealloc__() method.
    By the time your __dealloc__() method is called, the object
    may already have been partially destroyed and may not be
    in a valid state as far as Python is concerned, so you should
    avoid invoking any Python operations which might touch the
    object. In particular, don’t call any other methods of the object
    or do anything which might cause the object to be resurrected.
    It’s best if you stick to just deallocating C data.


Armin
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/JFMEQM6XPB6OLFNFMO4Q4PFM63XXXJDR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to