[Cython] regarding ticket #810 (segfault in Sage)

Stefan Behnel stefan_ml at behnel.de
Fri Apr 26 07:07:52 CEST 2013


Hi,

looking at this ticket:

http://trac.cython.org/cython_trac/ticket/810

and at the underlying Sage ticket:

http://trac.sagemath.org/sage_trac/ticket/14452

ISTM that this crash is not actually related to cdef kwargs but simply to
the fact that the C code is now calling directly through the C layer and no
longer through Python. The major difference being that Python puts
arguments into a tuple that is kept alive for the whole timespan of the
call, whereas C just passes in the reference and forgets about it.

Since the method in question replaces references internally, it's quite
possible that it somehow deletes the last reference to the object that was
passed in. I wouldn't really know why, as we specifically guard against
these things since somewhere around 0.17 (and comment #7 in the Sage ticket
shows an example of that), but maybe this is just a corner case that we
failed to handle so far, or maybe the Sage code is doing something
'unexpected' here.

Stefan


More information about the cython-devel mailing list