Skip to content
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

Support unpacking in yield/return #1091

Closed
JelleZijlstra opened this issue Oct 25, 2019 · 4 comments
Closed

Support unpacking in yield/return #1091

JelleZijlstra opened this issue Oct 25, 2019 · 4 comments
Labels
T: bug Something isn't working

Comments

@JelleZijlstra
Copy link
Collaborator

Python 3.8 made a minor syntax change to allow

def g():
    rest = (4, 5, 6)
    return 1, 2, 3, *rest

and the equivalent with yield. See https://bugs.python.org/issue32117.

Black doesn't support this syntax yet.

@JelleZijlstra JelleZijlstra added the T: bug Something isn't working label Oct 25, 2019
@vemel
Copy link
Contributor

vemel commented Oct 30, 2019

This looks like a bug in plib2to3 as it cannot parse * character in this line.

Unfortunately, even in py38 plib2to3 return statement does not support startest: https://github.com/python/cpython/blob/3.8/Lib/lib2to3/Grammar.txt#L52

I can prepare a PR though

@vemel
Copy link
Contributor

vemel commented Oct 30, 2019

I prepared a PR above and added a test

@vemel
Copy link
Contributor

vemel commented Oct 30, 2019

Added PR to CPython as well. I hope black can switch to official lib2to3 soon.

@isidentical
Copy link
Collaborator

Looks like #1121 merged, guess we can close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants