[Cython] Bug: Typed Memoryview and unicode string typ

Marvin Ritter marvin.ritter at gmail.com
Mon Feb 1 17:56:03 EST 2016


Hi,

First off all thanks to all of you for this awesome tool, it is working
great and I love it :)
Also the idea looks cool, I haven't been able to use typed memories views
as they seem broken for my setup:

Cython 0.23.4
Python 3.4 (and 3.5)
Compiler directive: c_string_type=unicode (which should be the same as str
in Python 3.x)

Steps:
cdef int* ptr = <int*>malloc(sizeof(int) * 10)
memView = <int[:n]>ptr

Result:
Compiles, but will raise a TypeError('expected bytes, str found') at runtime

I attached a minimal example.
Note that if you change the c_string_type to 'bytes' it will work fine.

Best
Marvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160201/4cf25e35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cython-string_type.zip
Type: application/zip
Size: 1439 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160201/4cf25e35/attachment.zip>


More information about the cython-devel mailing list