diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 0850ed4fc617cf221eab2640b45480fc75d9d33d..a27cc6d303a3a63952791a649f2d9ea26a5d4d62 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -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 index 0000000000000000000000000000000000000000..3d5a3597b3ed3d07b9af51ede39bf8f2af6fb1e2 --- /dev/null +++ b/tests/errors/invalid_uescapeN.pyx @@ -0,0 +1,7 @@ +# mode: error + +u'\N{GIBBET NICH}' + +_ERRORS = ''' +3:2: Unknown Unicode character name 'GIBBET NICH' +'''