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
80d50428
Commit
80d50428
authored
Apr 03, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix parse_syntax_error to clean up its resources
parent
6215444a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
20 deletions
+31
-20
Python/pythonrun.c
Python/pythonrun.c
+31
-20
No files found.
Python/pythonrun.c
View file @
80d50428
...
...
@@ -1335,56 +1335,67 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
return
PyArg_ParseTuple
(
err
,
"O(ziiz)"
,
message
,
filename
,
lineno
,
offset
,
text
);
/* new style errors. `err' is an instance */
*
message
=
NULL
;
if
(
!
(
v
=
PyObject_GetAttrString
(
err
,
"msg"
)))
/* new style errors. `err' is an instance */
*
message
=
PyObject_GetAttrString
(
err
,
"msg"
);
if
(
!*
message
)
goto
finally
;
*
message
=
v
;
if
(
!
(
v
=
PyObject_GetAttrString
(
err
,
"filename"
)))
v
=
PyObject_GetAttrString
(
err
,
"filename"
);
if
(
!
v
)
goto
finally
;
if
(
v
==
Py_None
)
if
(
v
==
Py_None
)
{
Py_DECREF
(
v
);
*
filename
=
NULL
;
else
if
(
!
(
*
filename
=
_PyUnicode_AsString
(
v
)))
goto
finally
;
}
else
{
*
filename
=
_PyUnicode_AsString
(
v
);
Py_DECREF
(
v
);
if
(
!*
filename
)
goto
finally
;
}
Py_DECREF
(
v
);
if
(
!
(
v
=
PyObject_GetAttrString
(
err
,
"lineno"
))
)
v
=
PyObject_GetAttrString
(
err
,
"lineno"
);
if
(
!
v
)
goto
finally
;
hold
=
PyLong_AsLong
(
v
);
Py_DECREF
(
v
);
v
=
NULL
;
if
(
hold
<
0
&&
PyErr_Occurred
())
goto
finally
;
*
lineno
=
(
int
)
hold
;
if
(
!
(
v
=
PyObject_GetAttrString
(
err
,
"offset"
)))
v
=
PyObject_GetAttrString
(
err
,
"offset"
);
if
(
!
v
)
goto
finally
;
if
(
v
==
Py_None
)
{
*
offset
=
-
1
;
Py_DECREF
(
v
);
v
=
NULL
;
}
else
{
hold
=
PyLong_AsLong
(
v
);
Py_DECREF
(
v
);
v
=
NULL
;
if
(
hold
<
0
&&
PyErr_Occurred
())
goto
finally
;
*
offset
=
(
int
)
hold
;
}
if
(
!
(
v
=
PyObject_GetAttrString
(
err
,
"text"
)))
v
=
PyObject_GetAttrString
(
err
,
"text"
);
if
(
!
v
)
goto
finally
;
if
(
v
==
Py_None
)
if
(
v
==
Py_None
)
{
Py_DECREF
(
v
);
*
text
=
NULL
;
else
if
(
!
PyUnicode_Check
(
v
)
||
!
(
*
text
=
_PyUnicode_AsString
(
v
)))
goto
finally
;
Py_DECREF
(
v
);
}
else
{
*
text
=
_PyUnicode_AsString
(
v
);
Py_DECREF
(
v
);
if
(
!*
text
)
goto
finally
;
}
return
1
;
finally:
Py_XDECREF
(
v
);
Py_XDECREF
(
*
message
);
return
0
;
}
...
...
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