From c001c09e9059ba04bc088349cd87a1374dc0754f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 30 Apr 2020 12:12:19 -0700 Subject: bpo-40334: Support type comments (GH-19780) This implements full support for # type: comments, # type: ignore 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. --- Python/bltinmodule.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 14c3e96fb5..82ca317c7e 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; -- cgit v1.2.1