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 positional-only params with old feature_version #94996

Closed
hauntsaninja opened this issue Jul 19, 2022 · 2 comments
Closed

ast.parse allows positional-only params with old feature_version #94996

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

Comments

@hauntsaninja
Copy link
Contributor

The following should raise SyntaxError:

ast.parse('def foo(x, /): ...', feature_version=(3, 7))
@hauntsaninja hauntsaninja added the type-bug An unexpected behavior, bug, or error label Jul 19, 2022
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Jul 19, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 12, 2022
… < (3, 8) (pythonGH-94997)

(cherry picked from commit b5e3ea2)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
miss-islington added a commit that referenced this issue Aug 12, 2022
… 8) (GH-94997)

(cherry picked from commit b5e3ea2)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
@lysnikolaou
Copy link
Member

Oops, after merging #94997, I figured out that we should probably do this for lambda parameters as well, right?

❯ ./python                  
Python 3.12.0a0 (heads/main:b5e3ea2862, Aug 12 2022, 19:50:42) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse('lambda x, /: ...')
<ast.Module object at 0x7fb4a02b8140>
>>> ast.parse('lambda x, /: ...', feature_version=(3, 7))
<ast.Module object at 0x7fb4a02b76b0>

@hauntsaninja
Copy link
Contributor Author

Great point, opened #95934

hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Aug 12, 2022
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Aug 12, 2022
…version < (3, 8) (pythonGH-94997).

(cherry picked from commit b5e3ea2)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Aug 12, 2022
…ersion < (3, 8) (pythonGH-95934)

(cherry picked from commit a965db3)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Aug 12, 2022
…ersion < (3, 8) (pythonGH-95934).

(cherry picked from commit a965db3)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
miss-islington pushed a commit that referenced this issue Aug 12, 2022
…n < (3, 8) (GH-95935)

(cherry picked from commit b5e3ea2)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Automerge-Triggered-By: GH:lysnikolaou
miss-islington pushed a commit that referenced this issue Aug 12, 2022
… < (3, 8) (GH-95934) (GH-95936)

(cherry picked from commit a965db3)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Automerge-Triggered-By: GH:lysnikolaou
miss-islington pushed a commit that referenced this issue Aug 12, 2022
… < (3, 8) (GH-95934) (GH-95938)

(cherry picked from commit a965db3)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Automerge-Triggered-By: GH:lysnikolaou
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