Author: Tyler Wade <[email protected]>
Branch: utf8-unicode2
Changeset: r72739:b895651fbbdc
Date: 2014-08-09 23:50 -0500
http://bitbucket.org/pypy/pypy/changeset/b895651fbbdc/
Log: Explicitly raise the IndexError for str objects
diff --git a/pypy/interpreter/utf8.py b/pypy/interpreter/utf8.py
--- a/pypy/interpreter/utf8.py
+++ b/pypy/interpreter/utf8.py
@@ -50,15 +50,16 @@
return res
def utf8ord(ustr, start=0):
- if start >= len(ustr):
- raise IndexError()
-
start = ustr.index_of_char(start)
return utf8ord_bytes(ustr.bytes, start)
@specialize.argtype(0)
def ORD(s, pos):
assert s is not None
+
+ if pos >= len(s):
+ raise IndexError()
+
if isinstance(s, Utf8Str):
return utf8ord(s, pos)
else:
@@ -493,7 +494,6 @@
res.reverse()
return res
- #@specialize.argtype(1)
def join(self, other):
if len(other) == 0:
return Utf8Str('')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit