Commit c0f91a65 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Fix for buffer testcase (s must be bytes, not unicode)

parent 35e28a5e
...@@ -11,11 +11,15 @@ if sys.version_info[0] >= 3: ...@@ -11,11 +11,15 @@ if sys.version_info[0] >= 3:
b'abcdefg' b'abcdefg'
>>> m1 = memoryview(b1) >>> m1 = memoryview(b1)
__getbuffer__ called
>>> m1.tobytes() >>> m1.tobytes()
__getbuffer__ called
b'abcdefg' b'abcdefg'
>>> m2 = memoryview(b2) >>> m2 = memoryview(b2)
__getbuffer__ called
>>> m2.tobytes() >>> m2.tobytes()
__getbuffer__ called
releasing! releasing!
b'abcdefg' b'abcdefg'
...@@ -24,10 +28,11 @@ b'abcdefg' ...@@ -24,10 +28,11 @@ b'abcdefg'
releasing! releasing!
""" """
s = "abcdefg" s = b"abcdefg"
cdef class TestBuffer: cdef class TestBuffer:
def __getbuffer__(self, Py_buffer* buffer, int flags): def __getbuffer__(self, Py_buffer* buffer, int flags):
print u"__getbuffer__ called"
buffer.buf = <char*>s buffer.buf = <char*>s
buffer.obj = self buffer.obj = self
buffer.len = len(s) buffer.len = len(s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment