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.

classification
Title: Use dict unpacking in idlelib
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: miss-islington, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2019-03-23 05:43 by terry.reedy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12507 merged terry.reedy, 2019-03-23 06:06
PR 12510 merged miss-islington, 2019-03-23 07:50
PR 12518 merged terry.reedy, 2019-03-23 21:35
PR 12526 merged miss-islington, 2019-03-24 21:12
Messages (11)
msg338643 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-23 05:43
Replace 3 occurrences of 'd = d1.copy(); d.update(d2)' pattern with 'd = {**d1, **d2}'.  Also remove unnecessary imports and uses of __main__.
msg338648 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-23 06:52
It is not unnecessary. globals() is not the same as __main__.__dict__.

It may be possible to use a ChainMap instead of merging dicts, but I do not think it matters.
msg338655 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-23 07:50
New changeset 2b75155590eb42d25e474b776ee9fdcc4b3dc840 by Terry Jan Reedy in branch 'master':
bpo-36405: Use dict unpacking in idlelib (#12507)
https://github.com/python/cpython/commit/2b75155590eb42d25e474b776ee9fdcc4b3dc840
msg338656 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-23 07:55
I hit merge before seeing your post here.  I based the globals change on

>>> import __main__
>>> __main__.__dict__ is globals()
True
msg338657 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-23 08:01
It is true only in the main script or REPL. But you executed that code in imported modules.
msg338659 - (view) Author: miss-islington (miss-islington) Date: 2019-03-23 08:08
New changeset 00986ec5530f004fca2c2675a822c73f06283bdf by Miss Islington (bot) in branch '3.7':
bpo-36405: Use dict unpacking in idlelib (GH-12507)
https://github.com/python/cpython/commit/00986ec5530f004fca2c2675a822c73f06283bdf
msg338661 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-23 09:55
You mean that the patch will execute the code in imported module where the two are not even equal.  So I will revert the '__main__' changes.

I found two differences in completion behavior with the patch.  One is a failure that should work, another is a success that should fail.  I will try to turn at least one of them into a new test that fails before the reversion and passes after.
msg338702 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-23 21:36
Also, __builtins__ is only a module, with a __dict__, in __main__.
msg338755 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-24 21:12
New changeset 0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9 by Terry Jan Reedy in branch 'master':
bpo-36405: IDLE - Restore __main__ and add tests (#12518)
https://github.com/python/cpython/commit/0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9
msg338757 - (view) Author: miss-islington (miss-islington) Date: 2019-03-24 21:32
New changeset 2b580146a53311e4202b0be63040740cdc01f1f5 by Miss Islington (bot) in branch '3.7':
bpo-36405: IDLE - Restore __main__ and add tests (GH-12518)
https://github.com/python/cpython/commit/2b580146a53311e4202b0be63040740cdc01f1f5
msg338765 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-24 23:10
Immediate followup is #30348, add autocomplete tests.  At least one would have failed with the initial patch.
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80586
2019-03-24 23:10:32terry.reedysetmessages: + msg338765
2019-03-24 21:44:05terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-03-24 21:32:42miss-islingtonsetmessages: + msg338757
2019-03-24 21:12:42miss-islingtonsetstage: commit review -> patch review
pull_requests: + pull_request12477
2019-03-24 21:12:30terry.reedysetmessages: + msg338755
2019-03-23 21:36:32terry.reedysetmessages: + msg338702
stage: patch review -> commit review
2019-03-23 21:35:51terry.reedysetstage: commit review -> patch review
pull_requests: + pull_request12469
2019-03-23 09:55:46terry.reedysetmessages: + msg338661
stage: patch review -> commit review
2019-03-23 08:08:58miss-islingtonsetnosy: + miss-islington
messages: + msg338659
2019-03-23 08:01:53serhiy.storchakasetmessages: + msg338657
2019-03-23 07:55:46terry.reedysetmessages: + msg338656
2019-03-23 07:50:29miss-islingtonsetpull_requests: + pull_request12461
2019-03-23 07:50:17terry.reedysetmessages: + msg338655
2019-03-23 06:52:03serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg338648
2019-03-23 06:06:31terry.reedysetkeywords: + patch
stage: commit review -> patch review
pull_requests: + pull_request12458
2019-03-23 05:43:09terry.reedycreate