[pypy-commit] pypy PyBuffer: Fix PyBuffer/BinaryBuffer confusion in _cffi_backend

rlamy pypy.commits at gmail.com
Sat Apr 1 11:22:52 EDT 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer
Changeset: r90891:d8147a9479bc
Date: 2017-04-01 02:13 +0100
http://bitbucket.org/pypy/pypy/changeset/d8147a9479bc/

Log:	Fix PyBuffer/BinaryBuffer confusion in _cffi_backend

diff --git a/pypy/module/_cffi_backend/cbuffer.py b/pypy/module/_cffi_backend/cbuffer.py
--- a/pypy/module/_cffi_backend/cbuffer.py
+++ b/pypy/module/_cffi_backend/cbuffer.py
@@ -79,20 +79,20 @@
         if space.isinstance_w(w_other, space.w_unicode):
             return space.w_NotImplemented
         try:
-            other_buf = space.buffer_w(w_other, space.BUF_SIMPLE)
+            other_pybuf = space.buffer_w(w_other, space.BUF_SIMPLE)
         except OperationError as e:
             if e.async(space):
                 raise
             return space.w_NotImplemented
         my_buf = self.buffer
         my_len = len(my_buf)
-        other_len = len(other_buf)
+        other_len = other_pybuf.getlength()
         if other_len != my_len:
             if mode == 'E':
                 return space.w_False
             if mode == 'N':
                 return space.w_True
-        cmp = _memcmp(my_buf, other_buf, min(my_len, other_len))
+        cmp = _memcmp(my_buf, other_pybuf.as_binary(), min(my_len, other_len))
         if cmp == 0:
             if my_len < other_len:
                 cmp = -1


More information about the pypy-commit mailing list