summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-04-18 22:55:37 (GMT)
committerGitHub <noreply@github.com>2018-04-18 22:55:37 (GMT)
commite5362eaa75a154c6e91c5b1c47719d0a0f5ca48b (patch)
tree213789668d45f15b8bbff0e16aea5dfe6874dca1 /Modules
parentc127a86e1862df88ec6f9d15b79c627fc616766e (diff)
downloadcpython-e5362eaa75a154c6e91c5b1c47719d0a0f5ca48b.zip
cpython-e5362eaa75a154c6e91c5b1c47719d0a0f5ca48b.tar.gz
cpython-e5362eaa75a154c6e91c5b1c47719d0a0f5ca48b.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/parsermodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 2b98be4..38e5f75 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -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 {