diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-05-31 23:26:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 23:26:16 (GMT) |
commit | b425d887aa51c8e7900b08cb8df457f450f6fbfd (patch) | |
tree | a18fa96d7d6a1659f5cbf30e699fc5298acfee0d /Python | |
parent | 29bfabe9709d4439cacb0806ba0e9f1dfd688157 (diff) | |
download | cpython-b425d887aa51c8e7900b08cb8df457f450f6fbfd.zip cpython-b425d887aa51c8e7900b08cb8df457f450f6fbfd.tar.gz cpython-b425d887aa51c8e7900b08cb8df457f450f6fbfd.tar.bz2 |
gh-92597: Ensure that AST nodes without explicit end positions can be compiled (GH-93359)
(cherry picked from commit 705eaec28f7bee530b1c1635ba385a49a1feaf32)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/Python-ast.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 3861eaf..e52a72d 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -5697,7 +5697,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_lineno = 0; + end_lineno = lineno; } else { int res; @@ -5714,7 +5714,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_col_offset = 0; + end_col_offset = col_offset; } else { int res; @@ -8114,7 +8114,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_lineno = 0; + end_lineno = lineno; } else { int res; @@ -8131,7 +8131,7 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_col_offset = 0; + end_col_offset = col_offset; } else { int res; @@ -10291,7 +10291,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_lineno = 0; + end_lineno = lineno; } else { int res; @@ -10308,7 +10308,7 @@ obj2ast_excepthandler(struct ast_state *state, PyObject* obj, excepthandler_ty* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_col_offset = 0; + end_col_offset = col_offset; } else { int res; @@ -10755,7 +10755,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_lineno = 0; + end_lineno = lineno; } else { int res; @@ -10772,7 +10772,7 @@ obj2ast_arg(struct ast_state *state, PyObject* obj, arg_ty* out, PyArena* arena) } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_col_offset = 0; + end_col_offset = col_offset; } else { int res; @@ -10877,7 +10877,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_lineno = 0; + end_lineno = lineno; } else { int res; @@ -10894,7 +10894,7 @@ obj2ast_keyword(struct ast_state *state, PyObject* obj, keyword_ty* out, } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_col_offset = 0; + end_col_offset = col_offset; } else { int res; @@ -10999,7 +10999,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_lineno = 0; + end_lineno = lineno; } else { int res; @@ -11016,7 +11016,7 @@ obj2ast_alias(struct ast_state *state, PyObject* obj, alias_ty* out, PyArena* } if (tmp == NULL || tmp == Py_None) { Py_CLEAR(tmp); - end_col_offset = 0; + end_col_offset = col_offset; } else { int res; |