[pypy-commit] pypy utf8-unicode2: Don't pass r_uint's to Utf8Builder.append
waedt
noreply at buildbot.pypy.org
Tue Aug 5 10:59:55 CEST 2014
Author: Tyler Wade <wayedt at gmail.com>
Branch: utf8-unicode2
Changeset: r72698:965da5f2a8a3
Date: 2014-08-05 03:27 -0500
http://bitbucket.org/pypy/pypy/changeset/965da5f2a8a3/
Log: Don't pass r_uint's to Utf8Builder.append
diff --git a/pypy/interpreter/utf8.py b/pypy/interpreter/utf8.py
--- a/pypy/interpreter/utf8.py
+++ b/pypy/interpreter/utf8.py
@@ -642,9 +642,7 @@
self._is_ascii = False
self._length += len(c)
- elif isinstance(c, int) or isinstance(c, base_int):
- c = intmask(c)
-
+ elif isinstance(c, int):
if c < 0x80:
self._builder.append(chr(c))
elif c < 0x800:
@@ -665,14 +663,13 @@
else:
raise ValueError("Invalid unicode codepoint > 0x10FFFF.")
self._length += 1
- elif isinstance(c, str):
+ else:
+ assert isinstance(c, str)
self._builder.append(c)
# XXX The assumption here is that the bytes being appended are
# ASCII, ie 1:1 byte:char
self._length += len(c)
- else:
- raise TypeError()
@specialize.argtype(1)
def append_slice(self, s, start, end):
diff --git a/pypy/interpreter/utf8_codecs.py b/pypy/interpreter/utf8_codecs.py
--- a/pypy/interpreter/utf8_codecs.py
+++ b/pypy/interpreter/utf8_codecs.py
@@ -163,7 +163,7 @@
else:
# when we get here, chr is a 32-bit unicode character
if chr <= MAXUNICODE:
- builder.append(chr)
+ builder.append(intmask(chr))
pos += digits
else:
More information about the pypy-commit
mailing list