Commit 5692f740 authored by Stefan Behnel's avatar Stefan Behnel

fix error reporting position for illegal string escapes

parent 5cdb7ba3
......@@ -785,18 +785,17 @@ def p_string_literal(s, kind_override=None):
if len(systr) == 4:
chars.append_charval( int(systr[2:], 16) )
else:
s.error("Invalid hex escape '%s'" % systr, pos=s.position())
s.error("Invalid hex escape '%s'" % systr)
elif c in u'Uu':
if kind in ('u', ''):
if len(systr) in (6,10):
chrval = int(systr[2:], 16)
if chrval > 1114111: # sys.maxunicode:
s.error("Invalid unicode escape '%s'" % systr,
pos = pos)
s.error("Invalid unicode escape '%s'" % systr)
else:
s.error("Invalid unicode escape '%s'" % systr, pos=s.position())
s.error("Invalid unicode escape '%s'" % systr)
else:
# unicode escapes in plain byte strings are not unescaped
# unicode escapes in byte strings are not unescaped
chrval = None
chars.append_uescape(chrval, systr)
else:
......
......@@ -2,5 +2,5 @@
u'\u'
_ERRORS = '''
2:1: Invalid unicode escape '\u'
2:2: Invalid unicode escape '\u'
'''
......@@ -2,5 +2,5 @@
u'\u12'
_ERRORS = '''
2:1: Invalid unicode escape '\u'
2:2: Invalid unicode escape '\u'
'''
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment