[pypy-commit] pypy PyBuffer-backport: Fix bytearray
rlamy
pypy.commits at gmail.com
Sat May 6 14:51:54 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer-backport
Changeset: r91195:dc72a659d99a
Date: 2017-05-06 19:50 +0100
http://bitbucket.org/pypy/pypy/changeset/dc72a659d99a/
Log: Fix bytearray
diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -2,18 +2,19 @@
from rpython.rlib.objectmodel import (
import_from_mixin, newlist_hint, resizelist_hint, specialize)
-from rpython.rlib.buffer import Buffer
from rpython.rlib.rstring import StringBuilder, ByteListBuilder
from rpython.rlib.debug import check_list_of_chars, check_nonneg
from rpython.rtyper.lltypesystem import rffi
from rpython.rlib.rgc import (resizable_list_supporting_raw_ptr,
nonmoving_raw_ptr_for_resizable_list)
from rpython.rlib import jit
+from rpython.rlib.buffer import Buffer
from pypy.interpreter.baseobjspace import W_Root
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
from pypy.interpreter.typedef import TypeDef
+from pypy.interpreter.buffer import SimpleView
from pypy.objspace.std.sliceobject import W_SliceObject, unwrap_start_stop
from pypy.objspace.std.stringmethods import StringMethods, _get_buffer
from pypy.objspace.std.stringmethods import _descr_getslice_slowpath
@@ -46,7 +47,7 @@
''.join(self._data[self._offset:]))
def buffer_w(self, space, flags):
- return BytearrayBuffer(self)
+ return SimpleView(BytearrayBuffer(self))
def readbuf_w(self, space):
return BytearrayBuffer(self, readonly=True)
diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py
--- a/pypy/objspace/std/stringmethods.py
+++ b/pypy/objspace/std/stringmethods.py
@@ -812,4 +812,4 @@
return [selfvalue[start + i*step] for i in range(sl)]
def _get_buffer(space, w_obj):
- return space.buffer_w(w_obj, space.BUF_SIMPLE)
+ return space.buffer_w(w_obj, space.BUF_SIMPLE).as_readbuf()
More information about the pypy-commit
mailing list