Author: Tyler Wade <[email protected]>
Branch: utf8-unicode2
Changeset: r73361:53178aaa779b
Date: 2014-09-07 12:38 -0500
http://bitbucket.org/pypy/pypy/changeset/53178aaa779b/
Log: Fix translation, but better
diff --git a/pypy/interpreter/utf8.py b/pypy/interpreter/utf8.py
--- a/pypy/interpreter/utf8.py
+++ b/pypy/interpreter/utf8.py
@@ -4,7 +4,6 @@
from rpython.rlib.runicode import utf8_code_length
from rpython.rlib.unicodedata import unicodedb_5_2_0 as unicodedb
from rpython.rlib.rarithmetic import r_uint, intmask, base_int
-from rpython.rlib.jit import elidable
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.tool.sourcetools import func_with_new_name
@@ -190,7 +189,6 @@
return byte_pos
-
def char_index_of_byte(self, byte_pos):
if self._is_ascii:
return byte_pos
@@ -268,6 +266,8 @@
is_ascii = False
stop_byte += increment
+ assert start_byte >= 0
+ assert stop_byte >= 0
return Utf8Str(self.bytes[start_byte:stop_byte], is_ascii,
stop - start)
@@ -399,6 +399,7 @@
if start < 0:
return -1
+ assert end >= 0
if isinstance(other, Utf8Str):
pos = self.bytes.find(other.bytes, start, end)
elif isinstance(other, str):
@@ -419,6 +420,7 @@
if start < 0:
return -1
+ assert end >= 0
if isinstance(other, Utf8Str):
pos = self.bytes.rfind(other.bytes, start, end)
elif isinstance(other, unicode):
@@ -438,6 +440,7 @@
if start < 0:
return 0
+ assert end >= 0
if isinstance(other, Utf8Str):
count = self.bytes.count(other.bytes, start, end)
elif isinstance(other, unicode):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit