On Monday 05 March 2007 1:03 am, bpat wrote:
> Hi,
>
> I upgrade from sage-1.5.1.2 to sage-2.2 and my sagex program doesn't
> compile anymore:
> the following make an error with sage-2.2 but not with sage-1.5.1.2
>
> # file test.spyx :
> def maplen(l):
>     return map(len,l)
>
> # command line :
> sage: attach test.spyx
> Compiling /home/patureau/Docs/Prog/SAGE/HFK/test_pyrex/test.spyx...
> Error compiling sagex file:
> Error converting test.spyx to C:
> Error converting Pyrex file to C:
> ------------------------------------------------------------
> .sage/spyx/test_spyx/test_spyx_0.pyx:7:15: Cannot convert 'Py_ssize_t
> ((PyObject *) except -1)' to Python object
>
> is this a bug or could you help me to understand.

Please change your program as follows:

def maplen(l):
    return [len(x) for x in l]

SageX now does a direct Python/C API call for len, which is much
faster, but means that len can't be used as flexibly as before.
But SageX also now supports very fast list comprehensions, so using
them instead of map is better anyways.

William

--~--~---------~--~----~------------~-------~--~----~
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-forum
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to