diff options
author | Michael J. Sullivan <sully@msully.net> | 2019-05-22 14:54:20 (GMT) |
---|---|---|
committer | Ivan Levkivskyi <levkivskyi@gmail.com> | 2019-05-22 14:54:20 (GMT) |
commit | 933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9 (patch) | |
tree | 97980dec3873370773b481e2bc1f08f9f1624b9d /Python/ast.c | |
parent | 4c7a46eb3c009c85ddf2eb315d94d804745187d4 (diff) | |
download | cpython-933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9.zip cpython-933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9.tar.gz cpython-933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9.tar.bz2 |
bpo-36878: Track extra text added to 'type: ignore' in the AST (GH-13479)
GH-13238 made extra text after a # type: ignore accepted by the parser.
This finishes the job and actually plumbs the extra text through the
parser and makes it available in the AST.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c index abc8d89..6259827 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -830,7 +830,10 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags, goto out; for (i = 0; i < num; i++) { - type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), arena); + string type_comment = new_type_comment(STR(CHILD(ch, i)), &c); + if (!type_comment) + goto out; + type_ignore_ty ti = TypeIgnore(LINENO(CHILD(ch, i)), type_comment, arena); if (!ti) goto out; asdl_seq_SET(type_ignores, i, ti); |