On 01/27/2015 05:38 PM, Richard Hansen wrote:
> Hi all,
> 
> If I create foo.pyx with the following contents:
> 
> cpdef object foo():
>     cdef unsigned char[:] s = <bytearray><unsigned char *>"012345"
>     return s
> 
> I notice the following behavior:
> 
> $ python -c '
> import foo
> m=foo.foo()
> print repr(memoryview(m.base).tobytes())
> print repr(memoryview(m).tobytes())
> '
> '012345'
> '123450'
> 
> Notice how the bytes are printed in the wrong order unless I use the
> original buffer object via the typed memoryview object's base attribute.

It turns out that this is due to a bug in Python, not Cython.
Fortunately it's relatively easy to work around this bug.  I submitted a
pull request containing a workaround:

https://github.com/cython/cython/pull/367

-Richard
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to