[pypy-commit] pypy faster-rstruct-2: fix test_pack_into_bytearray_delete
antocuni
pypy.commits at gmail.com
Wed May 17 11:48:01 EDT 2017
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91323:1d430f535203
Date: 2017-05-17 17:47 +0200
http://bitbucket.org/pypy/pypy/changeset/1d430f535203/
Log: fix test_pack_into_bytearray_delete
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
@@ -1308,6 +1308,9 @@
def _get_gc_data_offset():
return get_gc_data_offset_for_list_of_chars()
+ def _get_gc_data_extra_offset(self):
+ return self.ba._offset
+
def _get_gc_data(self):
return get_gc_data_for_list_of_chars(self.ba._data)
diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py
--- a/rpython/rlib/buffer.py
+++ b/rpython/rlib/buffer.py
@@ -159,6 +159,7 @@
@specialize.ll_and_arg(1)
def typed_read(self, TP, byte_offset):
lldata = self._get_gc_data()
+ byte_offset += self._get_gc_data_extra_offset()
return llop.gc_load_indexed(TP, lldata, byte_offset,
scale_factor, base_ofs)
@@ -167,6 +168,7 @@
if self.readonly:
raise CannotWrite
lldata = self._get_gc_data()
+ byte_offset += self._get_gc_data_extra_offset()
value = lltype.cast_primitive(TP, value)
return llop.gc_store_indexed(lltype.Void, lldata, byte_offset, value,
scale_factor, base_ofs)
@@ -179,6 +181,9 @@
def _get_gc_data_offset(self):
raise NotImplementedError
+ def _get_gc_data_extra_offset(self):
+ return 0
+
def _get_gc_data(self):
raise NotImplementedError
More information about the pypy-commit
mailing list