mirror of
https://github.com/python/cpython.git
synced 2025-09-02 15:07:53 +00:00
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.
This commit is contained in:
parent
4c7a46eb3c
commit
933e1509ec
9 changed files with 86 additions and 26 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue