-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-33064: lib2to3: support trailing comma after **kwargs #6096
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
Conversation
I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it).
ned-deily
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No review comments on the grammar changes. Perhaps @benjaminp has an interest in them? Otherwise, the NEWS entry cruft should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some extraneous blurb stuff to remove here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duh! Fixed :)
|
When you're done making the requested changes, leave the comment: |
|
Grammar change seems okay to me. |
I actually looked at the changes before approving the PR :) |
|
@1st1 I was sure you did. I just meant that I didn't! |
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @ned-deily, @1st1: please review the changes made to this pull request. |
|
Updated NEWS again, suspicious checker failed on this because there were no backticks around **kwargs. |
|
Any tests? |
|
Good call, Serhiy, I added some :) |
| *g:6, h:7, i=8, j:9=10, **k:11) -> 12: pass""" | ||
| self.validate(s) | ||
|
|
||
| def test_9(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to add tests for signatures like:
(a,)
(*args,)
(a=1,)
and few combinations if they have a separate path in the grammar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL, that's one subtle way to signal "your patch doesn't handle the vararg case" ;-) Alright, I added *args support, too, and added the relevant tests.
|
@ambv: Please replace |
|
Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
…ythonGH-6096) New tests also added. I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it). (cherry picked from commit b51f5de) Co-authored-by: Łukasz Langa <[email protected]>
|
GH-6097 is a backport of this pull request to the 3.7 branch. |
…ythonGH-6096) New tests also added. I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it). (cherry picked from commit b51f5de) Co-authored-by: Łukasz Langa <[email protected]>
|
GH-6098 is a backport of this pull request to the 3.6 branch. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unsure. The grammar rules are hard to read, tests allow to confirm suspicions.
I have doubts about some combinations. I would add tests for
(a, b)
(a, *b)
(a, b=1)
(a, **b)
(*a, b=1)
(*a, **b)
(*, b=1)
(a=1, b=2)
(a=1, **b)
with and without a trailing comma.
| typedargslist: ((tfpdef ['=' test] ',')* | ||
| ('*' [tname] (',' tname ['=' test])* [',' '**' tname] | '**' tname) | ||
| ('*' [tname] (',' tname ['=' test])* [',' ['**' tname [',']]] | '**' tname [',']) | ||
| | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be just tfpdef ['=' test] [',']? Of course may be there are reasons of writing the rule as it is written due to the parser limitations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe but I want to keep this as close to Grammar/Grammar and this is how it's voiced there.
…H-6096) (#6097) New tests also added. I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it). (cherry picked from commit b51f5de) Co-authored-by: Łukasz Langa <[email protected]>
…H-6096) (#6098) New tests also added. I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it). (cherry picked from commit b51f5de) Co-authored-by: Łukasz Langa <[email protected]>
|
@serhiy-storchaka, I merged this before I read your comment on the additional tests you'd like to see. I added the combinations you described in a separate pull request (see #6101). Thanks for your thorough review! |
…ython#6096) New tests also added. I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it).
Title says it like it is.
I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was
withdrawn, Kees Blom's railroad program has been lost to the sands of time for
at least 16 years now (I found a python-dev post from people looking for it).
It would be actually nice to make the rest of the grammar uniform with Grammar/Grammar whenever possible to be able to diff it easier for omissions. Of course, some differences will always be there to support Python 2 syntax, but a lot could be improved. I'll leave that for a separate commit though.
https://bugs.python.org/issue33064