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

bpo-38641: Add support of starred expressions in return/yield to lib2to3 #16994

Merged
merged 9 commits into from
Mar 1, 2020

Conversation

vemel
Copy link
Contributor

@vemel vemel commented Oct 30, 2019

Goal

bpo-32117 is fixed, but unfortunately lib2to3 still does not support unpacking in return and yield without parentheses.

def test():
    my_list = ["value2", "value3"]
    yield "value1", *my_list
    return "value1", *my_list

Changes

  • Use testlist_star_expr in return_stmt
  • Use testlist_star_expr in yield_arg

Summary

This is a backwards compatible change, because testlist_star_expr supports test as well like testlist does.

https://bugs.python.org/issue38641

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@vemel

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@vemel vemel changed the title bpo-32117: Add support to lib2to3 bpo-38641: Add support of starred expressions in return/yield to lib2to3 Oct 30, 2019
@pablogsal
Copy link
Member

Hi @vemel and thanks for the change!

Could you sign the CLA and add a NEWS entry? Thanks!

@vemel
Copy link
Contributor Author

vemel commented Oct 30, 2019

Hi @vemel and thanks for the change!

Could you sign the CLA and add a NEWS entry? Thanks!

I have already signed CLA. Going to add news section now.
I also adapted grammar unit tests

@vemel
Copy link
Contributor Author

vemel commented Oct 30, 2019

Just added news section.

@@ -0,0 +1 @@
Added starred expressions support to ``return`` and ``yield`` statements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you specify this is a bug related to lib2to3 here, also you can add a Patch by <name>. attribution at the end of news.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thank you!

Verified

This commit was signed with the committer’s verified signature.
vemel Vlad Emelianov

Verified

This commit was signed with the committer’s verified signature.
vemel Vlad Emelianov

Verified

This commit was signed with the committer’s verified signature.
vemel Vlad Emelianov
@vemel vemel requested a review from isidentical February 17, 2020 21:16
@codecov
Copy link

codecov bot commented Feb 17, 2020

Codecov Report

Merging #16994 into master will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #16994     +/-   ##
=========================================
  Coverage   82.11%   82.12%             
=========================================
  Files        1956     1955      -1     
  Lines      589364   584024   -5340     
  Branches    44457    44457             
=========================================
- Hits       483966   479605   -4361     
+ Misses      95746    94772    -974     
+ Partials     9652     9647      -5     
Impacted Files Coverage Δ
Lib/distutils/tests/test_bdist_rpm.py 30.00% <0.00%> (-65.00%) ⬇️
Lib/distutils/command/bdist_rpm.py 7.63% <0.00%> (-56.88%) ⬇️
Lib/test/test_urllib2net.py 76.92% <0.00%> (-13.85%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-7.15%) ⬇️
Lib/ftplib.py 63.85% <0.00%> (-6.06%) ⬇️
Lib/test/test_ftplib.py 87.11% <0.00%> (-4.72%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
Lib/test/test_socket.py 71.94% <0.00%> (-3.77%) ⬇️
Lib/test/test_asyncio/test_base_events.py 91.84% <0.00%> (-3.30%) ⬇️
... and 325 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c1b6a6...90405a3. Read the comment docs.

Verified

This commit was signed with the committer’s verified signature.
vemel Vlad Emelianov
@vemel
Copy link
Contributor Author

vemel commented Feb 17, 2020

Looks like unit test for MacOS are broken, but it is not related to current PR. Probably it makes sense to fix them in another PR.

Copy link
Member

@isidentical isidentical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for the ACKS file, I think you did something wrong while you were rebasing/merging. Can you check it again @vemel

Verified

This commit was signed with the committer’s verified signature.
vemel Vlad Emelianov

Verified

This commit was signed with the committer’s verified signature.
vemel Vlad Emelianov
@vemel
Copy link
Contributor Author

vemel commented Feb 20, 2020

LGTM except for the ACKS file, I think you did something wrong while you were rebasing/merging. Can you check it again @vemel

Indeed. Fixed.

@vemel vemel requested a review from isidentical February 20, 2020 17:51
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks, @vemel for the PR and @isidentical for the review :)

@isidentical
Copy link
Member

Thanks @vemel for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants