[pypy-commit] pypy utf8-unicode2: Explictly check for negative codepoints

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


Author: Tyler Wade <wayedt at gmail.com>
Branch: utf8-unicode2
Changeset: r72721:3a4bfe6c37ee
Date: 2014-08-08 22:00 -0500
http://bitbucket.org/pypy/pypy/changeset/3a4bfe6c37ee/

Log:	Explictly check for negative codepoints

diff --git a/pypy/interpreter/utf8.py b/pypy/interpreter/utf8.py
--- a/pypy/interpreter/utf8.py
+++ b/pypy/interpreter/utf8.py
@@ -642,7 +642,9 @@
 
 
     def append_codepoint(self, c):
-        if c < 0x80:
+        if c < 0:
+            raise ValueError("Invalid unicode codepoint < 0.")
+        elif c < 0x80:
             self._builder.append(chr(c))
         elif c < 0x800:
             self._builder.append(chr(0xC0 | (c >> 6)))


More information about the pypy-commit mailing list