Author: Ronan Lamy <ronan.l...@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() _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit