summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2020-04-30 19:12:19 (GMT)
committerGitHub <noreply@github.com>2020-04-30 19:12:19 (GMT)
commitc001c09e9059ba04bc088349cd87a1374dc0754f (patch)
tree74603d5653001e6fd7f4c02e2ddaed2efbdfb5a4 /Python
parentefb8dd5b3ec91f7d9458d3f203d748604d52b121 (diff)
downloadcpython-c001c09e9059ba04bc088349cd87a1374dc0754f.zip
cpython-c001c09e9059ba04bc088349cd87a1374dc0754f.tar.gz
cpython-c001c09e9059ba04bc088349cd87a1374dc0754f.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 14c3e96..82ca317 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -816,12 +816,8 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
if (str == NULL)
goto error;
- int current_use_peg = PyInterpreterState_Get()->config._use_peg_parser;
- if (flags & PyCF_TYPE_COMMENTS || feature_version >= 0 || compile_mode == 3) {
- PyInterpreterState_Get()->config._use_peg_parser = 0;
- }
result = Py_CompileStringObject(str, filename, start[compile_mode], &cf, optimize);
- PyInterpreterState_Get()->config._use_peg_parser = current_use_peg;
+
Py_XDECREF(source_copy);
goto finally;