This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Handle unpacking of */** arguments and rvalues in the compiler
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.9
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mark.Shannon, bar.harel, brandtbucher, pablogsal, vstinner
Priority: normal Keywords: patch

Created on 2020-01-13 12:28 by Mark.Shannon, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17984 merged Mark.Shannon, 2020-01-13 12:50
PR 18141 merged Mark.Shannon, 2020-01-23 09:38
PR 18243 closed brandtbucher, 2020-01-29 03:22
PR 18264 closed brandtbucher, 2020-01-30 01:03
Messages (5)
msg359901 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2020-01-13 12:28
Currently the unpacking of starred values in arguments and the right hand side of assignments is handled in the interpreter without any help from the compiler.
The layout of arguments and values is visible to the compiler, so the compiler should do more of the work.

We can replace the complex bytecodes used in unpacking with simpler more focused ones.
Specifically the collection building operations 
can be replaced with simpler, and self-explanatory operations:

In addition, the mapping operations
can be replaced with DICT_UPDATE and DICT_MERGE.

DICT_MERGE is like DICT_UPDATE but raises an exception for duplicate keys.

This change would not have much of an effect of performance, as the bytecodes listed are relatively rarely used, but shrinking the interpreter is always beneficial.
msg360548 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2020-01-23 09:25
New changeset 13bc13960cc83dbd1cb5701d9a59ac9b9144b205 by Mark Shannon in branch 'master':
bpo-39320: Handle unpacking of *values in compiler (GH-17984)
msg360749 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2020-01-27 09:57
New changeset 8a4cd700a7426341c2074a2b580306d2d60ec839 by Mark Shannon in branch 'master':
bpo-39320: Handle unpacking of **values in compiler (GH-18141)
msg375260 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-12 16:11
These changes introduced a regression: bpo-41531 "Python 3.9 regression: Literal dict with > 65535 items are one item shorter".
msg408857 - (view) Author: Bar Harel (bar.harel) * Date: 2021-12-18 15:41
Does this count as a regression or as an unintended bugfix for evaluation order?
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83501
2021-12-18 15:41:31bar.harelsetnosy: + bar.harel
messages: + msg408857
2021-08-30 09:13:18Mark.Shannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-08-12 16:11:30vstinnersetnosy: + vstinner
messages: + msg375260
2020-01-30 01:03:05brandtbuchersetpull_requests: + pull_request17641
2020-01-29 03:23:00brandtbuchersetnosy: + brandtbucher
2020-01-29 03:22:40brandtbuchersetpull_requests: + pull_request17623
2020-01-27 09:57:49Mark.Shannonsetmessages: + msg360749
2020-01-23 09:38:11Mark.Shannonsetpull_requests: + pull_request17527
2020-01-23 09:25:21Mark.Shannonsetmessages: + msg360548
2020-01-13 14:34:54pablogsalsetnosy: + pablogsal
2020-01-13 12:50:19Mark.Shannonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17388
2020-01-13 12:28:10Mark.Shannoncreate