Issue 33064: lib2to3 fails on a trailing comma after **kwargs in a function signature (original) (raw)

Created on 2018-03-13 02:50 by lukasz.langa, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6096 merged lukasz.langa,2018-03-13 02:56
PR 6096 merged lukasz.langa,2018-03-13 02:56
PR 6097 merged miss-islington,2018-03-13 07:44
PR 6098 merged miss-islington,2018-03-13 07:45
PR 6101 merged lukasz.langa,2018-03-13 09:05
Messages (9)
msg313718 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 02:50
Title says all. I have a patch.
msg313719 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 02:50
Ned, I'd like this to make into 3.6.5 if at all possible.
msg313722 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-03-13 07:07
Does it support a trailing comma after *args or name=value?
msg313723 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-03-13 07:26
I'm not sure that a trailing comma after **kwargs in a function signature should be allowed in Python grammar. Reasons for allowing it after other arguments don't work here since **kwargs is always a last item in a signature. But this ship perhaps is sailed.
msg313724 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 07:44
New changeset b51f5de71163f096d2d5229ede5379cdb284f651 by Łukasz Langa in branch 'master': bpo-33064: lib2to3: support trailing comma after *args and **kwargs (#6096) https://github.com/python/cpython/commit/b51f5de71163f096d2d5229ede5379cdb284f651
msg313725 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 07:49
Yes, this ship has sailed with Python 3.6. I understand your logic and this is indeed why we didn't support this for a long time. However, people tend to grow muscle memory to add trailing commas and that was tripping them over for no real gain on our part. So this was added. The reason I found out about lib2to3 not following suit was that 3.6 users quickly started to put those trailing commas in and tools using lib2to3 were crashing on such files :) This proves it was worth it.
msg313726 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 07:52
Oh, and in terms of *calling* functions, now we can specify multiple unpacks, like: >>> f( ... **d, ... **e, ... ) so the extra comma for signatures simply makes it symmetrical in terms of appearance.
msg313728 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 08:08
New changeset b4c8871ca43d37be167ef5dbe9fb341922c04a9f by Łukasz Langa (Miss Islington (bot)) in branch '3.7': bpo-33064: lib2to3: support trailing comma after *args and **kwargs (GH-6096) (#6097) https://github.com/python/cpython/commit/b4c8871ca43d37be167ef5dbe9fb341922c04a9f
msg313729 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-03-13 08:32
New changeset 6a526f673878677032c02f7800ee13d4769f391a by Łukasz Langa (Miss Islington (bot)) in branch '3.6': bpo-33064: lib2to3: support trailing comma after *args and **kwargs (GH-6096) (#6098) https://github.com/python/cpython/commit/6a526f673878677032c02f7800ee13d4769f391a
History
Date User Action Args
2022-04-11 14:58:58 admin set github: 77245
2018-03-13 22:19:55 lukasz.langa set keywords:patch, patchstatus: open -> closedstage: patch review -> resolved
2018-03-13 09:05:58 lukasz.langa set stage: commit review -> patch reviewpull_requests: + <pull%5Frequest5864>
2018-03-13 08:32:36 lukasz.langa set messages: +
2018-03-13 08:08:06 lukasz.langa set messages: +
2018-03-13 07:52:19 lukasz.langa set keywords:patch, patchmessages: +
2018-03-13 07:49:12 lukasz.langa set keywords:patch, patchresolution: fixedmessages: + stage: patch review -> commit review
2018-03-13 07:45:58 miss-islington set pull_requests: + <pull%5Frequest5861>
2018-03-13 07:44:58 miss-islington set pull_requests: + <pull%5Frequest5860>
2018-03-13 07:44:53 lukasz.langa set messages: +
2018-03-13 07:26:01 serhiy.storchaka set keywords:patch, patchmessages: +
2018-03-13 07:07:38 serhiy.storchaka set keywords:patch, patchnosy: + serhiy.storchakamessages: +
2018-03-13 02:56:38 lukasz.langa set keywords: + patchpull_requests: + <pull%5Frequest5859>
2018-03-13 02:56:37 lukasz.langa set keywords: + patchpull_requests: + <pull%5Frequest5858>
2018-03-13 02:50:58 lukasz.langa set nosy: + ned.deilymessages: + type: behaviorstage: patch review
2018-03-13 02:50:30 lukasz.langa create