[pypy-commit] pypy PyBuffer: Use .value_from_bytes() in ._getitem_tuple_indexed()
rlamy
pypy.commits at gmail.com
Mon Apr 17 10:53:26 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer
Changeset: r91062:3f7d3c653bf9
Date: 2017-04-17 15:52 +0100
http://bitbucket.org/pypy/pypy/changeset/3f7d3c653bf9/
Log: Use .value_from_bytes() in ._getitem_tuple_indexed()
diff --git a/pypy/objspace/std/memoryobject.py b/pypy/objspace/std/memoryobject.py
--- a/pypy/objspace/std/memoryobject.py
+++ b/pypy/objspace/std/memoryobject.py
@@ -9,7 +9,6 @@
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import interp2app
from pypy.interpreter.typedef import TypeDef, GetSetProperty, make_weakref_descr
-from pypy.module.struct.formatiterator import UnpackFormatIterator
from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib.objectmodel import always_inline
@@ -131,11 +130,9 @@
length, ndim)
start = self._start_from_tuple(space, w_index)
-
- buf = SubBuffer(self.buf.as_binary(), start, view.getitemsize())
- fmtiter = UnpackFormatIterator(space, buf)
- fmtiter.interpret(fmt)
- return fmtiter.result_w[0]
+ itemsize = self.getitemsize()
+ data = view.getbytes(start, start + itemsize, 1, itemsize)
+ return view.value_from_bytes(space, data)
def _decode_index(self, space, w_index, is_slice):
shape = self.getshape()
More information about the pypy-commit
mailing list