classification
Title: Incorrect parsing of unpacked expressions in call
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, python-dev, tcaswell, yselivanov
Priority: normal Keywords: patch

Created on 2015-05-13 14:07 by tcaswell, last changed 2015-05-16 13:45 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
unpack_grammar.patch tcaswell, 2015-05-13 14:07 review
Messages (2)
msg243087 - (view) Author: Thomas Caswell (tcaswell) * Date: 2015-05-13 14:07
On the current tip (changeset: 96023:4b5461dcd190) the following results in a syntax error

def test(a='a', b='b'):
    print(a, b)

opta = dict()
optb = dict(a=1, b=2)
test(**(opta or {}))  # <- works on all python
test(**optb or {})    # <- fails on current hg tip


This is suspected to be a result of https://hg.python.org/cpython/rev/a65f685ba8c0 

This was reported as an issue against sphinx (https://github.com/sphinx-doc/sphinx/pull/1889) and I was redirected here.

As suggested by Robert Lehmann suggests the issue is https://hg.python.org/cpython/rev/a65f685ba8c0#l1.33 which should be `** test`.  Making this change prevents the syntax error (patch attached).
msg243316 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-16 13:45
New changeset 38b2307372bf by Benjamin Peterson in branch 'default':
allow test node after ** in calls (closes #24176)
https://hg.python.org/cpython/rev/38b2307372bf
History
Date User Action Args
2015-05-16 13:45:05python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg243316

resolution: fixed
stage: resolved
2015-05-13 14:21:43yselivanovsetnosy: + benjamin.peterson, yselivanov
2015-05-13 14:07:25tcaswellcreate