On Mar 26, 2007, at 6:57 PM, didier deshommes wrote:
> My main beef is witht the segmentation fault, though. In python you
> simply get a TypeError.
> {{{
> In [1]: 1<<3 +1.2
> TypeError: unsupported operand type(s) for <<: 'int' and 'float'
> }}}
>
> Shouldn't it be the same for sage?
It's a stack overflow. When you do e.g. "2 << 2.3", it ends up calling
Coerce.bin_op_c() in sage/structure/coerce.pyx, which then falls
through to the line "return op(x,y)", and consequently calls itself
recursively forever. I don't know enough about what that function is
supposed to do to fix the bug. My gut feeling is that
Integer.__lshift__ shouldn't be using the coercion module; or at least,
the semantics for coercion for the shift operator need to be clarified.
David
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---