Em 1 de junho de 2011 18:22, Paulo César Pereira de Andrade <paulo.cesar.pereira.de.andr...@gmail.com> escreveu:
> If I understand it correctly, at least for this particular case: > > sage/libs/singular/groebner_strategy.pyx:GroebnerStrategy(SageObject)._parent > => > sage/rings/polynomial/multi_polynomial_libsingular.pyx:MPolynomialRing_libsingular(MPolynomialRing_generic) > > and the _parent field has a __dealloc__ as: > singular_ring_delete(self._ring) while the GroebnerStrategy > __dealloc__ deferences _parent._ring. > > So, again if I understand correctly, the crash is happening because > MPolynomialRing_libsingular:__deallocate__ should be called > after pyx:GroebnerStrategy:__deallocate__, but in python 2.7 > this is not happening, as the order is not guaranteed, and > apparently just happens to be in the correct order with > python 2.6. Sorry for replying to myself, but actually, it should be quite simple to have it functional, just that it must be done in a case by case approach. Something like: GroebnerStrategy(): __new__: ... the_ring_handle = ... incref(the_ring_handle) __del__: ... decref(the_ring_handle) del the_ring_handle ## requirement of this depends on semantics MPolynomialRing_libsingular(): __new__: ... the_ring_ptr = ... __del__: if (refcnt(self) <= 0) ## how to do this in python? check if == 1? or do not use python reference counter? free(the_ring_ptr) This should be easy for python internal experts to implement (I can try to experiment with that, but I do not know much of python and only do mark&sweep :-) Paulo -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org