From: Stefan Behnel Date: Sat, 15 Jan 2011 17:34:51 +0000 (+0100) Subject: fix error reporting position for illegal string escapes X-Git-Tag: 0.14.1rc0~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5692f740966ff60c7965b78427542378eae91e86;p=cython.git fix error reporting position for illegal string escapes --- diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 1b39d7cb..7f59c256 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -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: diff --git a/tests/errors/invalid_uescape0.pyx b/tests/errors/invalid_uescape0.pyx index 1aa52350..93d87ae0 100644 --- a/tests/errors/invalid_uescape0.pyx +++ b/tests/errors/invalid_uescape0.pyx @@ -2,5 +2,5 @@ u'\u' _ERRORS = ''' -2:1: Invalid unicode escape '\u' +2:2: Invalid unicode escape '\u' ''' diff --git a/tests/errors/invalid_uescape2.pyx b/tests/errors/invalid_uescape2.pyx index e91561f4..e98e0ce9 100644 --- a/tests/errors/invalid_uescape2.pyx +++ b/tests/errors/invalid_uescape2.pyx @@ -2,5 +2,5 @@ u'\u12' _ERRORS = ''' -2:1: Invalid unicode escape '\u' +2:2: Invalid unicode escape '\u' '''