mirror of
https://github.com/python/cpython.git
synced 2025-09-08 18:01:44 +00:00
bpo-33308: Fix a crash in the parser module when convert an ST object. (#6519)
Converting with line_info=False and col_info=True crashed before.
This commit is contained in:
parent
c127a86e18
commit
e5362eaa75
3 changed files with 27 additions and 10 deletions
|
@ -135,18 +135,18 @@ node2tuple(node *n, /* node to convert */
|
|||
goto error;
|
||||
(void) addelem(result, 1, w);
|
||||
|
||||
if (lineno == 1) {
|
||||
if (lineno) {
|
||||
w = PyLong_FromLong(n->n_lineno);
|
||||
if (w == NULL)
|
||||
goto error;
|
||||
(void) addelem(result, 2, w);
|
||||
}
|
||||
|
||||
if (col_offset == 1) {
|
||||
if (col_offset) {
|
||||
w = PyLong_FromLong(n->n_col_offset);
|
||||
if (w == NULL)
|
||||
goto error;
|
||||
(void) addelem(result, 3, w);
|
||||
(void) addelem(result, 2 + lineno, w);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue