Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 12, 2019
Merged

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

merged 1 commit into from
Jun 12, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented 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.

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
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

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

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
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

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

@vstinner
Copy link
Member Author

vstinner commented Jun 12, 2019

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