On Mon, Nov 16, 2009 at 3:28 AM, Fernando Perez
<fernando.pe...@berkeley.edu> wrote:
> On Mon, Nov 16, 2009 at 2:31 AM, Fernando Perez
> <fernando.pe...@berkeley.edu> wrote:
>> The fact that Ctrl-C cleanly stops the crazy loop *without* a
>> KeyboardInterrupt makes me think that ipython is trying to introspect
>> the MS object and some C code is going into a mad loop (otherwise we'd
>> see the Python signal handler showing a traceback).  Do you have any
>> other bugs related to this type of object that sound along those
>> lines?
>
> Half-right. IPython is swallowing the kbd interrupt, but the bug is in
> sage, it's the fact that len(MS) never returns:
>
> sage: MS = MatrixSpace(QQ,6,6,sparse=True); MS
> Full MatrixSpace of 6 by 6 sparse matrices over Rational Field
> sage: len(MS)
> ^C---------------------------------------------------------------------------
> KeyboardInterrupt                         Traceback (most recent call last)

Thanks!   Patch up at http://trac.sagemath.org/sage_trac/ticket/7449
for somebody to review.

William


>
> /home/fperez/ipython/repo/kernel-config-lp/docs/<ipython console> in 
> <module>()
>
> /opt/sage/local/lib/python2.6/site-packages/sage/structure/parent.so
> in sage.structure.parent.Parent.__len__
> (sage/structure/parent.c:5533)()
>
> /opt/sage/local/lib/python2.6/site-packages/sage/structure/parent.so
> in sage.structure.parent.Parent.list (sage/structure/parent.c:4995)()
>
> /opt/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
> in __iter__(self)
>    751             while True:
>    752                 for iv in
> sage.combinat.integer_vector.IntegerVectors(weight,
> number_of_entries):
> --> 753                     yield self(entries=[base_elements[i] for i
> in iv], rows=True)
>    754
>    755                 weight += 1
>
> /opt/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
> in __call__(self, entries, coerce, copy, rows)
>    371             copy = False
>    372         elif self.__is_sparse and isinstance(entries, (list, tuple)):
> --> 373             entries = list_to_dict(entries, self.__nrows,
> self.__ncols, rows=rows)
>    374             coerce = True
>    375             copy = False
>
> /opt/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
> in list_to_dict(entries, nrows, ncols, rows)
>   1240                 d[(row,col)] = x
>   1241             else:
> -> 1242                 d[(col,row)] = x
>   1243     return d
>   1244
>
> /opt/sage/local/lib/python2.6/site-packages/sage/interfaces/get_sigs.pyc
> in my_sigint(x, n)
>      7
>      8 def my_sigint(x, n):
> ----> 9     raise KeyboardInterrupt
>     10
>     11 def my_sigfpe(x, n):
>
> KeyboardInterrupt:
>
>
> It seems that the ms object implements __len__, but this function
> never returns.  It's just that ipython was calling len() on it.
>
> Cheers,
>
> f
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to