Issue 36405: Use dict unpacking in idlelib (original) (raw)

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:12 admin set github: 80586
2019-03-24 23:10:32 terry.reedy set messages: +
2019-03-24 21:44:05 terry.reedy set status: open -> closedresolution: fixedstage: patch review -> resolved
2019-03-24 21:32:42 miss-islington set messages: +
2019-03-24 21:12:42 miss-islington set stage: commit review -> patch reviewpull_requests: + <pull%5Frequest12477>
2019-03-24 21:12:30 terry.reedy set messages: +
2019-03-23 21:36:32 terry.reedy set messages: + stage: patch review -> commit review
2019-03-23 21:35:51 terry.reedy set stage: commit review -> patch reviewpull_requests: + <pull%5Frequest12469>
2019-03-23 09:55:46 terry.reedy set messages: + stage: patch review -> commit review
2019-03-23 08:08:58 miss-islington set nosy: + miss-islingtonmessages: +
2019-03-23 08:01:53 serhiy.storchaka set messages: +
2019-03-23 07:55:46 terry.reedy set messages: +
2019-03-23 07:50:29 miss-islington set pull_requests: + <pull%5Frequest12461>
2019-03-23 07:50:17 terry.reedy set messages: +
2019-03-23 06:52:03 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2019-03-23 06:06:31 terry.reedy set keywords: + patchstage: commit review -> patch reviewpull_requests: + <pull%5Frequest12458>
2019-03-23 05:43:09 terry.reedy create