-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Wrong Python.asdl
type for keys
in Dict
literals
#131421
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
Comments
This comment has been minimized.
This comment has been minimized.
Right, but there aren't 0 or more expressions, but rather 0 or more optional expressions, ie an expression can be None instead of an actual |
This comment has been minimized.
This comment has been minimized.
Ah I understand your point now. You mean that the None is not a true None but a sentinel None. |
(Adding the relevant labels as the PR being proposed suggests a way to improve the existing grammar parser) |
This is still in the docs project. |
…#131419) In the `ast` documentation for Python: * https://docs.python.org/3/library/ast.html#ast.Dict it is made clear that: > When doing dictionary unpacking using dictionary literals the expression to be expanded goes in the values list, with a `None` at the corresponding position in `keys`. Hence, `keys` is really a `expr?*` and *not* a `expr*`. Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
in our script.
PR python#131419 broke this, but we failed to run tests on the PR due to a bug in our script.
Merged #131419 |
In the
Python.asdl
syntax description, the file asserts thatDict
literalkeys
have typeexpr*
. This is false.keys
can be optional.In the ast documentation for Python:
Hence, keys is really a expr?* and not a expr*.
Linked PRs
Dict
to have anexpr?*
keys field #131419The text was updated successfully, but these errors were encountered: