Manuel Jacob committed 456bc41

Fall back to calling app-level __buffer__ when it's not possible to call the interp-level buffer API.

  • Participants
  • Parent commits 8c9b03d
  • Branches refactor-buffer-api

Comments (0)

Files changed (1)


         return None
     def buffer_w(self, space):
+        from pypy.module.__builtin__.interp_memoryview import W_Buffer
+        w_impl = space.lookup(self, '__buffer__')
+        if w_impl is not None:
+            w_result = space.get_and_call_function(w_impl, self)
+            if isinstance(w_result, W_Buffer):
+                return w_result.buf
         self._typed_unwrap_error(space, "buffer")
     def str_w(self, space):