[Cython] error when cythonizing unicode

Stefan Behnel stefan_ml at behnel.de
Sat Feb 16 12:46:09 CET 2008


Hi,

Ondrej Certik wrote:
> another bug was discovered in the Cython 0.9.6.11 in Debian:
> 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464751

Here is a test case with things I could imagine to work for "unicode":

-------------------------------
__doc__ = """
   >>> u('test')
   u'test'
   >>> z
   u'test'
   >>> c('testing')
   u'testing'
   >>> subu('testing a Python subtype')
   u'testing a Python subtype'
   >>> csubu('testing a C subtype')
   u'testing a C subtype'
   >>> sub('testing a Python subtype')
   u'testing a Python subtype'
   >>> csub('testing a C subtype')
   u'testing a C subtype'
"""

u = unicode          # doesn't currently work
z = unicode('test')

class subu(unicode):  # doesn't currently work
    pass

cdef class csubu(unicode): # doesn't currently work
    pass

def c(string):
    return unicode(string)

def csub(string):
    return csubu(string)

def sub(string):
    return subu(string)
-------------------------------

My work-around fixes the first two cases, so that's not too bad. And I think
the "cdef" thing would be a new feature anyway.

@Robert: maybe we should remove the "builtin_functions" dict in Symtab.py
completely. It looks like it just breaks things.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: package-upstream.bundle
Type: application/octet-stream
Size: 877 bytes
Desc: not available
Url : http://codespeak.net/pipermail/cython-dev/attachments/20080216/bb25ac7f/attachment.obj 


More information about the Cython-dev mailing list