Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
5692f740
Commit
5692f740
authored
Jan 15, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error reporting position for illegal string escapes
parent
5cdb7ba3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+4
-5
tests/errors/invalid_uescape0.pyx
tests/errors/invalid_uescape0.pyx
+1
-1
tests/errors/invalid_uescape2.pyx
tests/errors/invalid_uescape2.pyx
+1
-1
No files found.
Cython/Compiler/Parsing.py
View file @
5692f740
...
@@ -785,18 +785,17 @@ def p_string_literal(s, kind_override=None):
...
@@ -785,18 +785,17 @@ def p_string_literal(s, kind_override=None):
if
len
(
systr
)
==
4
:
if
len
(
systr
)
==
4
:
chars
.
append_charval
(
int
(
systr
[
2
:],
16
)
)
chars
.
append_charval
(
int
(
systr
[
2
:],
16
)
)
else
:
else
:
s
.
error
(
"Invalid hex escape '%s'"
%
systr
,
pos
=
s
.
position
()
)
s
.
error
(
"Invalid hex escape '%s'"
%
systr
)
elif
c
in
u'Uu'
:
elif
c
in
u'Uu'
:
if
kind
in
(
'u'
,
''
):
if
kind
in
(
'u'
,
''
):
if
len
(
systr
)
in
(
6
,
10
):
if
len
(
systr
)
in
(
6
,
10
):
chrval
=
int
(
systr
[
2
:],
16
)
chrval
=
int
(
systr
[
2
:],
16
)
if
chrval
>
1114111
:
# sys.maxunicode:
if
chrval
>
1114111
:
# sys.maxunicode:
s
.
error
(
"Invalid unicode escape '%s'"
%
systr
,
s
.
error
(
"Invalid unicode escape '%s'"
%
systr
)
pos
=
pos
)
else
:
else
:
s
.
error
(
"Invalid unicode escape '%s'"
%
systr
,
pos
=
s
.
position
()
)
s
.
error
(
"Invalid unicode escape '%s'"
%
systr
)
else
:
else
:
# unicode escapes in
plain
byte strings are not unescaped
# unicode escapes in byte strings are not unescaped
chrval
=
None
chrval
=
None
chars
.
append_uescape
(
chrval
,
systr
)
chars
.
append_uescape
(
chrval
,
systr
)
else
:
else
:
...
...
tests/errors/invalid_uescape0.pyx
View file @
5692f740
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
u'
\
u
'
u'
\
u
'
_ERRORS = '''
_ERRORS = '''
2:
1
: Invalid unicode escape '
\
u'
2:
2
: Invalid unicode escape '
\
u'
'''
'''
tests/errors/invalid_uescape2.pyx
View file @
5692f740
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
u'
\
u
12
'
u'
\
u
12
'
_ERRORS
=
'''
_ERRORS
=
'''
2:
1
: Invalid unicode escape '
\
u
'
2:
2
: Invalid unicode escape '
\
u
'
'''
'''
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment