[pypy-commit] pypy py3.5: parameter moved, calling StringBuffer before parameter is passed to _array_to_hexstring, seems to translate now

plan_rich pypy.commits at gmail.com
Fri Jan 13 11:07:53 EST 2017


Author: Richard Plangger <planrichi at gmail.com>
Branch: py3.5
Changeset: r89543:08b6498f72ef
Date: 2017-01-13 17:07 +0100
http://bitbucket.org/pypy/pypy/changeset/08b6498f72ef/

Log:	parameter moved, calling StringBuffer before parameter is passed to
	_array_to_hexstring, seems to translate now

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
@@ -578,7 +578,7 @@
 HEXDIGITS = "0123456789abcdef"
 PY_SIZE_T_MAX = intmask(2**(rffi.sizeof(rffi.SIZE_T)*8-1)-1)
 
- at specialize.arg(3) # raw access
+ at specialize.arg(5) # raw access
 def _array_to_hexstring(space, buf, start, step, length, rawaccess=False):
     hexstring = StringBuilder(length*2)
 
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -678,7 +678,7 @@
 
     def descr_hex(self, space):
         from pypy.objspace.std.bytearrayobject import _array_to_hexstring
-        return _array_to_hexstring(space, self._value, 0, 1, len(self._value), True)
+        return _array_to_hexstring(space, StringBuffer(self._value), 0, 1, len(self._value))
 
     def descr_mod(self, space, w_values):
         return mod_format(space, self, w_values, fmt_type=FORMAT_BYTES)
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
@@ -3,7 +3,7 @@
 """
 import operator
 
-from rpython.rlib.buffer import Buffer, SubBuffer
+from rpython.rlib.buffer import Buffer, SubBuffer, StringBuffer
 from rpython.rlib.objectmodel import compute_hash
 from rpython.rlib.rstruct.error import StructError
 from pypy.interpreter.baseobjspace import W_Root
@@ -687,7 +687,7 @@
             return _array_to_hexstring(space, self.buf, 0, 1, self.getlength())
         else:
             bytes = self.as_str()
-            return _array_to_hexstring(space, bytes, 0, 1, len(bytes), True)
+            return _array_to_hexstring(space, StringBuffer(bytes), 0, 1, len(bytes))
 
 def is_byte_format(char):
     return char == 'b' or char == 'B' or char == 'c'


More information about the pypy-commit mailing list