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

ast.parse allows parenthesised context managers with old feature_version #94949

Closed
hauntsaninja opened this issue Jul 18, 2022 · 2 comments
Closed
Labels
type-bug An unexpected behavior, bug, or error

Comments

@hauntsaninja
Copy link
Contributor

The following should raise SyntaxError:

ast.parse('with (CtxManager() as example): ...', feature_version=(3, 9))
@hauntsaninja hauntsaninja added the type-bug An unexpected behavior, bug, or error label Jul 18, 2022
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Jul 18, 2022
@pablogsal
Copy link
Member

Thanks for the issue @hauntsaninja

Although we made it official in 3.10, it works on 3.9. Tools supporting 3.9 don't need to support this, but I don't see the advantage in marking it as invalid and being that strict, specially since 3.9 is now in security fixes only

@hauntsaninja
Copy link
Contributor Author

Thanks, updated the PR to check 3.9 instead of 3.10

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 18, 2022
…re_version (pythonGH-94950)

* pythongh-94949: Disallow parsing parenthesised ctx manager with old feature_version

* 📜🤖 Added by blurb_it.

* Allow it with feature_version=(3, 9) as well

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0daba82)

Co-authored-by: Shantanu <[email protected]>
pablogsal pushed a commit that referenced this issue Jul 18, 2022
…sion (#94950)

* gh-94949: Disallow parsing parenthesised ctx manager with old feature_version

* 📜🤖 Added by blurb_it.

* Allow it with feature_version=(3, 9) as well

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
miss-islington added a commit that referenced this issue Jul 18, 2022
…sion (GH-94950)

* gh-94949: Disallow parsing parenthesised ctx manager with old feature_version

* 📜🤖 Added by blurb_it.

* Allow it with feature_version=(3, 9) as well

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0daba82)

Co-authored-by: Shantanu <[email protected]>
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Jul 19, 2022
…d feature_version (pythonGH-94950)

(cherry picked from commit 0daba82)

Co-authored-by: Shantanu <[email protected]>
pablogsal pushed a commit that referenced this issue Jul 19, 2022
…ure_version (GH-94950) (#94990)

(cherry picked from commit 0daba82)

Co-authored-by: Shantanu <[email protected]>
AlexWaygood added a commit to AlexWaygood/cpython that referenced this issue Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants