]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40334: Support type comments (GH-19780)
authorGuido van Rossum <guido@python.org>
Thu, 30 Apr 2020 19:12:19 +0000 (12:12 -0700)
committerGitHub <noreply@github.com>
Thu, 30 Apr 2020 19:12:19 +0000 (12:12 -0700)
commitc001c09e9059ba04bc088349cd87a1374dc0754f
tree74603d5653001e6fd7f4c02e2ddaed2efbdfb5a4
parentefb8dd5b3ec91f7d9458d3f203d748604d52b121
bpo-40334: Support type comments (GH-19780)

This implements full support for # type: <type> comments, # type: ignore <stuff> comments, and the func_type parsing mode for ast.parse() and compile().

Closes https://github.com/we-like-parsers/cpython/issues/95.

(For now, you need to use the master branch of mypy, since another issue unique to 3.9 had to be fixed there, and there's no mypy release yet.)

The only thing missing is `feature_version=N`, which is being tracked in https://github.com/we-like-parsers/cpython/issues/124.
Grammar/python.gram
Lib/test/test_type_comments.py
Parser/pegen/parse.c
Parser/pegen/pegen.c
Parser/pegen/pegen.h
Python/bltinmodule.c