This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: *args regression
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, larry, ncoghlan, ned.deily, o11c, python-dev, yselivanov, zach.ware
Priority: release blocker Keywords: 3.4regression, patch

Created on 2015-08-05 03:42 by o11c, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue24791.patch yselivanov, 2015-08-05 04:37 review
Messages (10)
msg248014 - (view) Author: Ben Longbons (o11c) * Date: 2015-08-05 03:42
The following code is allowed by the grammar of Python 3.4, but not Python 3.5:

`def f(): g(*a or b)`

where unary `*` has the lowest precedence, i.e. it is equivalent to:

`def f(): g(*(a or b))`

The cause of the regression that the 3.4 grammar for `arglist` uses `'*' test` but the 3.5 grammar uses `'*' expr`. This is likely an oversight due to the PEP 448 changes; the fix should most likely be applied to the new `display`s as well as fixing the regression.


***

Thanks to zware on IRC for actually testing this for me, since I don't have a runnable python3.5, just docs.
msg248015 - (view) Author: Ben Longbons (o11c) * Date: 2015-08-05 03:44
Related: bug 24176 fixed this for the `**` case.
msg248016 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-08-05 03:53
New changeset 3c170f68407f by Zachary Ware in branch '3.4':
Issue #24791: Add tests for things that regressed with PEP 448
https://hg.python.org/cpython/rev/3c170f68407f
msg248017 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-08-05 03:55
Test committed on 3.4; I'm not comfortable enough with the grammar to actually fix the issue (the obvious change of `star_expr` => `'*' test` isn't enough, I tried :)).
msg248018 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-08-05 04:37
The attached patch should fix that. Please review.
msg248020 - (view) Author: Ben Longbons (o11c) * Date: 2015-08-05 05:06
Also consider:

*() or (), *() or ()
[*() or (), *() or ()]
{*() or (), *() or ()}
{**{} or {}, **{} or {}}

Note that the second-or-later argument is a separate part of the grammar so that's why I wrote it twice.

Actually, I think `star_expr` will probably go away entirely.
msg248044 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-08-05 14:55
> Actually, I think `star_expr` will probably go away entirely.

I'm not so concerned with supporting [*[] or []] stuff, but rather fixing the immediate regression in 3.5.0.  I'd keep the patch size to the minimum.
msg248082 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-08-05 21:55
New changeset e4cb64628673 by Yury Selivanov in branch '3.5':
Issue #24791: Fix grammar regression for call syntax: 'g(*a or b)'.
https://hg.python.org/cpython/rev/e4cb64628673

New changeset 4c89dd5199e5 by Yury Selivanov in branch 'default':
Merge 3.5 (issue #24791)
https://hg.python.org/cpython/rev/4c89dd5199e5
msg248083 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-08-05 22:00
New changeset 40c391d12741 by Yury Selivanov in branch '3.5':
Issue #24791: More tests in test_parser
https://hg.python.org/cpython/rev/40c391d12741

New changeset a572137b4f05 by Yury Selivanov in branch 'default':
Merge 3.5 (issue #24791; more tests in test_parser)
https://hg.python.org/cpython/rev/a572137b4f05
msg252251 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-04 03:03
New changeset 20e0906a808e by Terry Jan Reedy in branch '3.5':
Issue #24791: Escape rst markup char in NEWS entry to avoid Sphinx warning.
https://hg.python.org/cpython/rev/20e0906a808e
History
Date User Action Args
2022-04-11 14:58:19adminsetnosy: + ned.deily
github: 68979
2015-10-04 03:03:41python-devsetmessages: + msg252251
2015-08-05 22:01:00yselivanovsetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2015-08-05 22:00:39python-devsetmessages: + msg248083
2015-08-05 21:55:33python-devsetmessages: + msg248082
2015-08-05 14:55:23yselivanovsetmessages: + msg248044
2015-08-05 05:06:50o11csetmessages: + msg248020
2015-08-05 04:48:33yselivanovsetnosy: + ncoghlan, larry
2015-08-05 04:37:25yselivanovsetfiles: + issue24791.patch
keywords: + patch
messages: + msg248018
2015-08-05 03:55:48zach.waresetmessages: + msg248017
2015-08-05 03:53:26python-devsetnosy: + python-dev
messages: + msg248016
2015-08-05 03:52:36zach.waresetnosy: + benjamin.peterson, zach.ware, yselivanov
versions: + Python 3.6
priority: normal -> release blocker
keywords: + 3.4regression
type: behavior
stage: needs patch
2015-08-05 03:44:47o11csetmessages: + msg248015
2015-08-05 03:42:24o11ccreate