add error test case for unknown \N{...} Unicode escape name
authorStefan Behnel <stefan_ml@behnel.de>
Sun, 6 Jan 2013 19:26:39 +0000 (20:26 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Sun, 6 Jan 2013 19:26:39 +0000 (20:26 +0100)
Cython/Compiler/Parsing.py
tests/errors/invalid_uescapeN.pyx [new file with mode: 0644]

index 0850ed4..a27cc6d 100644 (file)
@@ -815,7 +815,8 @@ def p_string_literal(s, kind_override=None):
                         try:
                             chrval = ord(unicodedata.lookup(systr[3:-1]))
                         except KeyError:
-                            s.error("Unknown Unicode character name %r" % systr[3:-1])
+                            s.error("Unknown Unicode character name %s" %
+                                    repr(systr[3:-1]).lstrip('u'))
                     elif len(systr) in (6,10):
                         chrval = int(systr[2:], 16)
                         if chrval > 1114111: # sys.maxunicode:
diff --git a/tests/errors/invalid_uescapeN.pyx b/tests/errors/invalid_uescapeN.pyx
new file mode 100644 (file)
index 0000000..3d5a359
--- /dev/null
@@ -0,0 +1,7 @@
+# mode: error
+
+u'\N{GIBBET NICH}'
+
+_ERRORS = '''
+3:2: Unknown Unicode character name 'GIBBET NICH'
+'''