On Tue, Jan 31, 2012 at 11:54:27PM -0800, Christian Stump wrote:
> Getting a graph only doesn't seem to be the problem; does the same
> error occur on other machines as well? Any ideas what the problem
> might be?

I reduced the segfault to:

        sage: M = matrix(ZZ,3,[0,1,0,-1,0,-1,0,1,0]); M
        sage: M._travel_column({0:1},0,-1,True)
        *BOOM*

The issue is in the `any(... for i in d)` of _travel_column in
#10347. Cython has been upgraded between Sage 4.7.2 and 4.8, with
increased support for iterators, and I assume we are stumbling on a
glitch there. I reduced the code as much as possible and reported that
glitch on #12408.

Christian: you can most likely work around this by using a for loop.

Lesson to be learned: it took me 1/2 hour to locate the source of the
issue, whereas locating an exception raised in Python code is
instantaneous with the debugger. Then it took one more 1/2 hour to
reduce the code, because of the 10s compilation time at each
iteration. Not counting the time it costed before to Florent,
Christian, ... So in respect to the recent discussion on Sage-devel
raised by Nathann, and as long as we do not have an easy to use
interactive debugger (like pdb) for Cython code, I recommend like
William to not use Cython when there is no compelling reason to do
so. Compelling reasons include:

 - writing speed critical sections of code
 - adding methods to a currently existing class in a cython file
   (so Christian did not have a choice here).

On a similar note, and again if speed is not *critical*, it's safer to
preserve the encapsulation by using e.g. .nrows() and [i,j] rather
than ._nrows and ._get_unsafe(i,j).

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to