Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 Lib/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def parse(source, filename='<unknown>', mode='exec', *,
if type_comments:
flags |= PyCF_TYPE_COMMENTS
return compile(source, filename, mode, flags,
feature_version=feature_version)
_feature_version=feature_version)


def literal_eval(node_or_string):
Expand Down
5 changes: 3 additions & 2 deletions 5 Lib/test/test_type_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ def parse(self, source, feature_version=highest):
feature_version=feature_version)

def parse_all(self, source, minver=lowest, maxver=highest, expected_regex=""):
for feature_version in range(self.lowest, self.highest + 1):
if minver <= feature_version <= maxver:
for version in range(self.lowest, self.highest + 1):
feature_version = (3, version)
if minver <= version <= maxver:
try:
yield self.parse(source, feature_version)
except SyntaxError as err:
Expand Down
5 changes: 3 additions & 2 deletions 5 Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ compile as builtin_compile
flags: int = 0
dont_inherit: bool(accept={int}) = False
optimize: int = -1
feature_version: int = -1
*
_feature_version as feature_version: int = -1

Compile source into a code object that can be executed by exec() or eval().

Expand All @@ -716,7 +717,7 @@ static PyObject *
builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
const char *mode, int flags, int dont_inherit,
int optimize, int feature_version)
/*[clinic end generated code: output=b0c09c84f116d3d7 input=5fcc30651a6acaa9]*/
/*[clinic end generated code: output=b0c09c84f116d3d7 input=40171fb92c1d580d]*/
{
PyObject *source_copy;
const char *str;
Expand Down
14 changes: 9 additions & 5 deletions 14 Python/clinic/bltinmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.