[pypy-commit] pypy fix-strbuf: (fijal, arigo) push push push
arigo
noreply at buildbot.pypy.org
Sun Jul 26 11:50:19 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: fix-strbuf
Changeset: r78664:586fe659736b
Date: 2015-07-26 11:48 +0200
http://bitbucket.org/pypy/pypy/changeset/586fe659736b/
Log: (fijal, arigo) push push push
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
@@ -77,11 +77,13 @@
def _op_val(space, w_other):
return space.buffer_w(w_other, space.BUF_SIMPLE).as_str()
- def _chr(self, char):
+ @staticmethod
+ def _chr(char):
assert len(char) == 1
- return str(char)[0]
+ return char[0]
- def _multi_chr(self, char):
+ @staticmethod
+ def _multi_chr(char):
return [char]
@staticmethod
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
@@ -483,7 +483,7 @@
@staticmethod
def _use_rstr_ops(space, w_other):
from pypy.objspace.std.unicodeobject import W_UnicodeObject
- return (isinstance(w_other, W_BytesObject) or
+ return (isinstance(w_other, W_AbstractBytesObject) or
isinstance(w_other, W_UnicodeObject))
@staticmethod
@@ -495,9 +495,10 @@
raise
return space.charbuf_w(w_other)
- def _chr(self, char):
+ @staticmethod
+ def _chr(char):
assert len(char) == 1
- return str(char)[0]
+ return char[0]
_builder = StringBuilder
diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py
--- a/pypy/objspace/std/stringmethods.py
+++ b/pypy/objspace/std/stringmethods.py
@@ -28,7 +28,8 @@
start, end = unwrap_start_stop(space, lenself, w_start, w_end)
return (value, start, end)
- def _multi_chr(self, c):
+ @staticmethod
+ def _multi_chr(c):
return c
def descr_len(self, space):
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -117,9 +117,10 @@
return unicode_from_encoded_object(
space, w_other, None, "strict")._value
- def _chr(self, char):
+ @staticmethod
+ def _chr(char):
assert len(char) == 1
- return unicode(char)[0]
+ return unichr(ord(char[0]))
_builder = UnicodeBuilder
More information about the pypy-commit
mailing list