[pypy-commit] pypy remove-string-smm: Replace bytearray.reverse multimethod (fijal, hodgestar).
hodgestar
noreply at buildbot.pypy.org
Tue Apr 16 22:50:19 CEST 2013
Author: Simon Cross <hodgestar at gmail.com>
Branch: remove-string-smm
Changeset: r63436:748667f013a0
Date: 2013-04-16 22:50 +0200
http://bitbucket.org/pypy/pypy/changeset/748667f013a0/
Log: Replace bytearray.reverse multimethod (fijal, hodgestar).
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
@@ -119,6 +119,9 @@
"found", i, space.type(w_s).getname(space))
return W_BytearrayObject(newdata)
+ def descr_reverse(self, space):
+ self.data.reverse()
+
def __repr__(w_self):
""" representation for debugging purposes """
return "%s(%s)" % (w_self.__class__.__name__, ''.join(w_self.data))
@@ -461,10 +464,6 @@
w_str = str__Bytearray(space, w_bytearray)
return stringobject.str_isspace__String(space, w_str)
-def bytearray_reverse__Bytearray(space, w_bytearray):
- w_bytearray.data.reverse()
- return space.w_None
-
_space_chars = ''.join([chr(c) for c in [9, 10, 11, 12, 13, 32]])
def bytearray_strip__Bytearray_None(space, w_bytearray, w_chars):
diff --git a/pypy/objspace/std/bytearraytype.py b/pypy/objspace/std/bytearraytype.py
--- a/pypy/objspace/std/bytearraytype.py
+++ b/pypy/objspace/std/bytearraytype.py
@@ -85,10 +85,13 @@
"""
raise NotImplementedError
+ def descr_reverse(self, space):
+ """B.reverse() -> None
-bytearray_reverse = SMM('reverse', 1,
- doc="B.reverse() -> None\n\n"
- "Reverse the order of the values in B in place.")
+ Reverse the order of the values in B in place.
+ """
+ raise NotImplementedError
+
bytearray_strip = SMM('strip', 2, defaults=(None,),
doc="B.strip([bytes]) -> bytearray\n\nStrip leading "
@@ -234,5 +237,6 @@
append=interpindirect2app(W_AbstractBytearrayObject.descr_append),
extend=interpindirect2app(W_AbstractBytearrayObject.descr_extend),
join=interpindirect2app(W_AbstractBytearrayObject.descr_join),
+ reverse=interpindirect2app(W_AbstractBytearrayObject.descr_reverse),
)
bytearray_typedef.registermethods(globals())
More information about the pypy-commit
mailing list