[pypy-commit] pypy py3k: buffer_w now takes flags, Buffers must now be _immutable_
pjenvey
noreply at buildbot.pypy.org
Wed Apr 30 01:12:02 CEST 2014
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r71074:cc37714daab8
Date: 2014-04-29 16:08 -0700
http://bitbucket.org/pypy/pypy/changeset/cc37714daab8/
Log: buffer_w now takes flags, Buffers must now be _immutable_
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
@@ -48,7 +48,7 @@
self.buffer = buffer
self.keepalive = keepalive
- def buffer_w(self, space):
+ def buffer_w(self, space, flags):
return self.buffer
def descr_len(self, space):
diff --git a/pypy/module/_io/interp_bytesio.py b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -12,6 +12,8 @@
class BytesIOBuffer(Buffer):
+ _immutable_ = True
+
def __init__(self, w_bytesio):
self.w_bytesio = w_bytesio
diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py
--- a/pypy/module/cpyext/buffer.py
+++ b/pypy/module/cpyext/buffer.py
@@ -36,5 +36,7 @@
self.c_len)
class CBuffer(CBufferMixin, buffer.Buffer):
+ _immutable_ = True
+
def __del__(self):
CBufferMixin.destructor(self)
diff --git a/pypy/module/cpyext/bytesobject.py b/pypy/module/cpyext/bytesobject.py
--- a/pypy/module/cpyext/bytesobject.py
+++ b/pypy/module/cpyext/bytesobject.py
@@ -253,7 +253,7 @@
the buffer protocol."""
if space.is_w(space.type(w_obj), space.w_bytes):
return w_obj
- buffer = space.buffer_w(w_obj)
+ buffer = space.buffer_w(w_obj, space.BUF_FULL_RO)
return space.wrapbytes(buffer.as_str())
More information about the pypy-commit
mailing list