[pypy-commit] pypy fix-strbuf: If unicodedata_handler happens to be None here, don't interpret \N

arigo noreply at buildbot.pypy.org
Wed Jul 29 15:16:15 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: fix-strbuf
Changeset: r78708:522b1566ead2
Date: 2015-07-26 19:42 +0200
http://bitbucket.org/pypy/pypy/changeset/522b1566ead2/

Log:	If unicodedata_handler happens to be None here, don't interpret \N
	sequences at all

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -1275,16 +1275,9 @@
                             "unicodeescape", errorhandler, message, errors)
 
         # \N{name}
-        elif ch == 'N':
+        elif ch == 'N' and unicodedata_handler is not None:
             message = "malformed \\N character escape"
             look = pos
-            if unicodedata_handler is None:
-                message = ("\\N escapes not supported "
-                           "(can't load unicodedata module)")
-                res, pos = errorhandler(errors, "unicodeescape",
-                                        message, s, pos-1, size)
-                builder.append(res)
-                continue
 
             if look < size and s[look] == '{':
                 # look for the closing brace


More information about the pypy-commit mailing list