diff options
author | Michael J. Sullivan <sully@msully.net> | 2019-05-11 18:17:24 (GMT) |
---|---|---|
committer | Ivan Levkivskyi <levkivskyi@gmail.com> | 2019-05-11 18:17:24 (GMT) |
commit | d8320ecb86da8df7c13d8bf8582507f736aa2924 (patch) | |
tree | 87fc131f7bfdda0688b1d93ab9bce801c5f8a944 /Misc | |
parent | 6236c9823ef3e8e2229b0598d3d8189adf5e00f2 (diff) | |
download | cpython-d8320ecb86da8df7c13d8bf8582507f736aa2924.zip cpython-d8320ecb86da8df7c13d8bf8582507f736aa2924.tar.gz cpython-d8320ecb86da8df7c13d8bf8582507f736aa2924.tar.bz2 |
bpo-36878: Allow extra text after `# type: ignore` comments (GH-13238)
In the parser, when using the type_comments=True option, recognize
a TYPE_IGNORE as anything containing `# type: ignore` followed by
a non-alphanumeric character. This is to allow ignores such as
`# type: ignore[E1000]`.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-05-10-22-00-06.bpo-36878.iigeqk.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-05-10-22-00-06.bpo-36878.iigeqk.rst b/Misc/NEWS.d/next/Library/2019-05-10-22-00-06.bpo-36878.iigeqk.rst new file mode 100644 index 0000000..20b44dc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-10-22-00-06.bpo-36878.iigeqk.rst @@ -0,0 +1,4 @@ +When using `type_comments=True` in `ast.parse`, treat `# type: ignore` followed by
+a non-alphanumeric character and then arbitrary text as a type ignore, instead of
+requiring nothing but whitespace or another comment. This is to permit formations
+such as `# type: ignore[E1000]`.
\ No newline at end of file |