Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a4b48f19
Commit
a4b48f19
authored
Oct 12, 2018
by
Zackery Spytz
Committed by
Serhiy Storchaka
Oct 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34940: Fix the error handling in _check_for_legacy_statements(). (GH-9764)
parent
859c068e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
Objects/exceptions.c
Objects/exceptions.c
+18
-8
No files found.
Objects/exceptions.c
View file @
a4b48f19
...
...
@@ -2906,7 +2906,7 @@ _check_for_legacy_statements(PySyntaxErrorObject *self, Py_ssize_t start)
*/
static
PyObject
*
print_prefix
=
NULL
;
static
PyObject
*
exec_prefix
=
NULL
;
Py_ssize_t
text_len
=
PyUnicode_GET_LENGTH
(
self
->
text
);
Py_ssize_t
text_len
=
PyUnicode_GET_LENGTH
(
self
->
text
)
,
match
;
int
kind
=
PyUnicode_KIND
(
self
->
text
);
void
*
data
=
PyUnicode_DATA
(
self
->
text
);
...
...
@@ -2929,9 +2929,12 @@ _check_for_legacy_statements(PySyntaxErrorObject *self, Py_ssize_t start)
return
-
1
;
}
}
if
(
PyUnicode_Tailmatch
(
self
->
text
,
print_prefix
,
start
,
text_len
,
-
1
))
{
match
=
PyUnicode_Tailmatch
(
self
->
text
,
print_prefix
,
start
,
text_len
,
-
1
);
if
(
match
==
-
1
)
{
return
-
1
;
}
if
(
match
)
{
return
_set_legacy_print_statement_msg
(
self
,
start
);
}
...
...
@@ -2942,10 +2945,17 @@ _check_for_legacy_statements(PySyntaxErrorObject *self, Py_ssize_t start)
return
-
1
;
}
}
if
(
PyUnicode_Tailmatch
(
self
->
text
,
exec_prefix
,
start
,
text_len
,
-
1
))
{
Py_XSETREF
(
self
->
msg
,
PyUnicode_FromString
(
"Missing parentheses in call to 'exec'"
));
match
=
PyUnicode_Tailmatch
(
self
->
text
,
exec_prefix
,
start
,
text_len
,
-
1
);
if
(
match
==
-
1
)
{
return
-
1
;
}
if
(
match
)
{
PyObject
*
msg
=
PyUnicode_FromString
(
"Missing parentheses in call "
"to 'exec'"
);
if
(
msg
==
NULL
)
{
return
-
1
;
}
Py_XSETREF
(
self
->
msg
,
msg
);
return
1
;
}
/* Fall back to the default error message */
...
...
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