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

bpo-35766: compile(): rename feature_version parameter#13994

Merged
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:compile_feature_versionCopy head branch name to clipboard
Jun 12, 2019
Merged

bpo-35766: compile(): rename feature_version parameter#13994
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:compile_feature_versionCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented Jun 12, 2019

Copy link
Copy Markdown
Member

Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.

https://bugs.python.org/issue35766

Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.
@vstinner

Copy link
Copy Markdown
Member Author

I proposed this change to make the further changes that I proposed in PR #13992. The PR #13992 introduced an inconsistency between ast.parse() and compile() API for feature_version. So I propose to make compile() feature_version private. Anyway, the parameter only makes sense for ast.parse() anyway, and it's undocumented on purpose.

I skipped the NEWS entry since feature_version is not documented on purpose:
https://docs.python.org/dev/library/functions.html#compile

@ilevkivskyi ilevkivskyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, as I said I am fine with this.

@vstinner vstinner merged commit efdf6ca into python:master Jun 12, 2019
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@vstinner vstinner deleted the compile_feature_version branch June 12, 2019 00:52
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 12, 2019
Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.
(cherry picked from commit efdf6ca)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@bedevere-bot

Copy link
Copy Markdown

GH-13995 is a backport of this pull request to the 3.8 branch.

@vstinner

vstinner commented Jun 12, 2019

Copy link
Copy Markdown
Member Author

Note: I saw that importlib has a source_to_code() which has a keyword-only "private" parameter: parameter called "_optimize", and the "_" prefix in Python stands for "private thing". I reused the idea here ;-)

We might make the parameter public later if needed, but I would prefer to accept the feature_version=(3, 6) format in that case. Right now, it's not needed, so I just made it private ;-)

vstinner added a commit that referenced this pull request Jun 12, 2019
…-14001)

Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.

(cherry picked from commit efdf6ca)
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

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