[Cython] Bug in ord(Py_UNICODE) optimization

John Ehresman jpe at wingware.com
Fri May 27 21:55:37 CEST 2011


Hi,

ord() applied to a Py_UNICODE typed variable seems to yield a 1 
character unicode string rather than an integer.  The following doctest 
fails when added to unicodefunction.pyx:

def Py_UNICODE_ord(unicode s):
     """
     >>> Py_UNICODE_ord(u' ')
     32
     """
     cdef Py_UNICODE u
     u = s[0]
     return ord(u)

Thanks,

John


More information about the cython-devel mailing list