diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-04-18 22:11:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-18 22:11:05 -0700 |
commit | fc8693dc7a228d687bf066e163f82a7724b58b68 (patch) | |
tree | c22dfed3303ec6a197e4ed811dc82f59334706e3 /Modules/parsermodule.c | |
parent | 1957e7b76a1319995360492223a4dfe1cd5d105c (diff) | |
download | cpython-git-fc8693dc7a228d687bf066e163f82a7724b58b68.tar.gz |
bpo-33308: Fix a crash in the parser module when convert an ST object. (GH-6519)
Converting with line_info=False and col_info=True crashed before.
(cherry picked from commit e5362eaa75a154c6e91c5b1c47719d0a0f5ca48b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Modules/parsermodule.c')
-rw-r--r-- | Modules/parsermodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index a4443350ef..710efc2d56 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -136,18 +136,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 { |