New issue 2995: unpacking + py35+ *splat: SyntaxError: can't use starred expression here https://bitbucket.org/pypy/pypy/issues/2995/unpacking-py35-splat-syntaxerror-cant-use
Anthony Sottile: Here's sample code which works correctly in cpython 3.5+ ```python def f(*args): if len(args) == 1: x, y = (0, *args) elif len(args) == 2: x, y = args else: raise TypeError('{} {!r}'.format(len(args), args)) print(x, y) f(1) f(1, 2) f(1, 2, 3) ``` Here's the expected output in python3.5: ```console $ python3.5 t2.py 0 1 1 2 Traceback (most recent call last): File "t2.py", line 13, in <module> f(1, 2, 3) File "t2.py", line 7, in f raise TypeError('{} {!r}'.format(len(args), args)) TypeError: 3 (1, 2, 3) ``` pypy3.5 (and pypy3.6) reject this code with a `SyntaxError`: ```console $ ./pypy3.6-v7.1.0-linux64/bin/pypy3 --version Python 3.6.1 (de061d87e39c, Mar 24 2019, 22:18:07) [PyPy 7.1.0-beta0 with GCC 6.2.0 20160901] $ pypy3 --version Python 3.5.3 (fdd60ed87e94, Apr 24 2018, 06:10:04) [PyPy 6.0.0 with GCC 6.2.0 20160901] $ ./pypy3.6-v7.1.0-linux64/bin/pypy3 t2.py File "t2.py", line 3 x, y = (0, *args) ^ SyntaxError: can't use starred expression here $ pypy3 t2.py File "t2.py", line 3 x, y = (0, *args) ^ SyntaxError: can't use starred expression here ``` Here's a much smaller reproduction: ```python x = (1,) a, b = (*x, 2) ``` _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue