HI, Thanks for the comments, really interesting use case this one [1], I've just read it in diagonal but seems that is similar to the bug that finally I've found in our program.
Basically GC was clearing all of the attributes before the deallocation for unbreaking an indirect reference cycle which resulted later in access to an invalid address during the deallocation, this is something that is already advised in the CYthon documentation. [1] https://bugs.python.org/issue38006 On Sat, Jan 11, 2020 at 1:36 PM Armin Rigo <armin.r...@gmail.com> wrote: > > 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 -- --pau _______________________________________________ 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/7FUOIKLO27U67VPPI2HLM3GLWXQ64ESF/ Code of Conduct: http://python.org/psf/codeofconduct/