Skip to content

bpo-39320: Handle unpacking of **values in compiler #18141

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

Merged

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jan 23, 2020

This is the second part of the implementation of bpo-39320.
Part 1 was #17984

This PR replaces BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL
with DICT_MERGE and DICT_UPDATE.

DICT_UPDATE n calls item_n.update(tos) where item_n is the nth item on the stack and tos is popped from the stack.
DICT_MERGE n is the same, but raises an exception if there are duplicate keys.

https://bugs.python.org/issue39320

@markshannon markshannon force-pushed the handle-dict-unpacking-in-compiler branch from b6ad237 to 95e421c Compare January 23, 2020 10:11
@@ -0,0 +1,12 @@

Replace two complex bytecodes for building dicts with two simpler ones.

Copy link
Member

Choose a reason for hiding this comment

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

Different paragraphs render badly when joining the NEWS entries, sadly

@markshannon markshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 23, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @markshannon for commit 2d2fe4c 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 23, 2020
@pablogsal
Copy link
Member

The failures in AMD64 Fedora Stable Clang Installed PR , buildbot/PPC64 Fedora PR and buildbot/x86 Gentoo Installed with X PR are unrelated so don't worry about them.

@markshannon
Copy link
Member Author

OK, merging.

@markshannon markshannon merged commit 8a4cd70 into python:master Jan 27, 2020
@markshannon markshannon deleted the handle-dict-unpacking-in-compiler branch January 27, 2020 09:57
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
* Add DICT_UPDATE and DICT_MERGE bytecodes. Use them for ** unpacking.

* Remove BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL, as they are now unused.

* Update magic number for ** unpacking opcodes.

* Update dis.rst to incorporate new bytecodes.

* Add blurb entry.
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.

4 participants