Author: Manuel Jacob Branch: refactor-str-types Changeset: r65655:e38a40e646e8 Date: 2013-07-25 19:38 +0200 http://bitbucket.org/pypy/pypy/changeset/e38a40e646e8/
Log: Make the annotator happy. 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 @@ -29,7 +29,7 @@ return "%s(%s)" % (w_self.__class__.__name__, ''.join(w_self.data)) def _new(self, value): - return W_BytearrayObject(value) + return W_BytearrayObject(list(value)) def _len(self): return len(self.data) @@ -41,7 +41,8 @@ return space.bufferstr_new_w(w_other) def _chr(self, char): - return str(char) + assert len(char) == 1 + return str(char)[0] _builder = StringBuilder 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 @@ -83,7 +83,8 @@ #return w_other._value def _chr(self, char): - return str(char) + assert len(char) == 1 + return str(char)[0] _builder = StringBuilder 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 @@ -84,7 +84,8 @@ return unicode_from_encoded_object(space, w_other, None, "strict")._value def _chr(self, char): - return unicode(char) + assert len(char) == 1 + return unicode(char)[0] _builder = UnicodeBuilder _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit