[pypy-commit] pypy utf8-unicode2: Fix crash when using an incomplete format specific (ie u'%(foo' % {})

waedt noreply at buildbot.pypy.org
Sat Aug 9 11:05:11 CEST 2014


Author: Tyler Wade <wayedt at gmail.com>
Branch: utf8-unicode2
Changeset: r72729:31e5deb73708
Date: 2014-08-09 04:04 -0500
http://bitbucket.org/pypy/pypy/changeset/31e5deb73708/

Log:	Fix crash when using an incomplete format specific (ie u'%(foo' %
	{})

diff --git a/pypy/interpreter/utf8.py b/pypy/interpreter/utf8.py
--- a/pypy/interpreter/utf8.py
+++ b/pypy/interpreter/utf8.py
@@ -50,6 +50,9 @@
     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)
 


More information about the pypy-commit mailing list