From c0f91a65cf818f18f9870722f44d51f5efd350ef Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Tue, 20 Oct 2009 10:46:09 +0200 Subject: [PATCH] Fix for buffer testcase (s must be bytes, not unicode) --- tests/run/buffer.pyx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/run/buffer.pyx b/tests/run/buffer.pyx index 07d344e1..3e9f4177 100644 --- a/tests/run/buffer.pyx +++ b/tests/run/buffer.pyx @@ -11,11 +11,15 @@ if sys.version_info[0] >= 3: b'abcdefg' >>> m1 = memoryview(b1) +__getbuffer__ called >>> m1.tobytes() +__getbuffer__ called b'abcdefg' >>> m2 = memoryview(b2) +__getbuffer__ called >>> m2.tobytes() +__getbuffer__ called releasing! b'abcdefg' @@ -24,10 +28,11 @@ b'abcdefg' releasing! """ -s = "abcdefg" +s = b"abcdefg" cdef class TestBuffer: def __getbuffer__(self, Py_buffer* buffer, int flags): + print u"__getbuffer__ called" buffer.buf = s buffer.obj = self buffer.len = len(s) -- 2.26.2