Skip to content

gh-89520: IDLE - Make extentions use user's keys, not all defaults#28713

Merged
gpshead merged 54 commits into
python:mainfrom
CoolCat467:patch-1
Apr 12, 2026
Merged

gh-89520: IDLE - Make extentions use user's keys, not all defaults#28713
gpshead merged 54 commits into
python:mainfrom
CoolCat467:patch-1

Conversation

@CoolCat467

@CoolCat467 CoolCat467 commented Oct 3, 2021

Copy link
Copy Markdown
Contributor

I was trying to write an extension for Idle, and was noticing extension keys defined in ~/.idlerc weren't being used, so I looked into it and found that in idlelib.config.idleConf, GetExtensionKeys, __GetRawExtensionKeys, and GetKeyBinding would never check for user keys, always assuming default keys have everything. This is not always true. In a system with multiple users, you would not want to modify the default config file for a custom extension, as that is used for everyone. This pull request is changing aforementioned functions to also check user config files, and overwrite values acquired from the default config file if the user config redefined one.

Edit:
The especially interesting part is that extensions are loaded anyways if they have an entry in the user's IDLE configuration file, but their keybinds are only loaded properly if they are defined in the root configuration file at the moment. This pull request is fixing this difference and allows extension keybinds to be loaded from the user's IDLE configuration file, making user extensions work just as well as root extensions.

I was trying to write an extension for Idle, and was noticing extension keys defined in ~/.idlerc weren't being used, so I looked into it and found `GetExtensionKeys`, `__GetRawExtensionKeys`, and `GetKeyBinding` would never check for user keys, always assuming default keys have everything. This is not always true. In a system with multiple users, you would not want to modify the default config file for a custom extension, as that is used for everyone. This pull request is changing aforementioned functions to also check user config files, and overwrite values acquired from the default config file if the user config redefined one.
blurb-it Bot and others added 3 commits October 3, 2021 21:55
Comment thread Lib/idlelib/config.py Outdated
Comment thread Lib/idlelib/config.py Outdated
CoolCat467 and others added 3 commits February 1, 2022 14:57
@terryjreedy terryjreedy changed the title bpo-45357: Make extentions use user's keys, not all defaults bpo-45357: IDLE - Make extentions use user's keys, not all defaults Nov 2, 2022
@terryjreedy terryjreedy self-assigned this Nov 2, 2022
@terryjreedy terryjreedy changed the title bpo-45357: IDLE - Make extentions use user's keys, not all defaults gh-89520: IDLE - Make extentions use user's keys, not all defaults Nov 2, 2022
@python python deleted a comment from the-knights-who-say-ni Nov 2, 2022

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

manually tested in addition to the unittests, it appears to work. i refactored the change with claude a bit to polish it up and address any remaining issues.

@gpshead gpshead self-assigned this Apr 12, 2026
@gpshead gpshead enabled auto-merge (squash) April 12, 2026 04:19
@gpshead gpshead merged commit 208195d into python:main Apr 12, 2026
55 checks passed
@CoolCat467 CoolCat467 deleted the patch-1 branch April 12, 2026 04:44
@CoolCat467

Copy link
Copy Markdown
Contributor Author

Thank you so much! I've been waiting to get this merged for five years now, glad this is finally done.

ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…fig (pythonGH-28713)

Extension keybindings defined in ~/.idlerc/config-extensions.cfg were silently ignored because GetExtensionKeys, __GetRawExtensionKeys, and GetExtensionBindings only checked default config. Fix these to check user config as well, and update the extensions config dialog to handle user-only extensions correctly.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
@terryjreedy terryjreedy added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 3, 2026
@miss-islington-app

miss-islington-app Bot commented Jul 3, 2026

Copy link
Copy Markdown

Sorry, @CoolCat467 and @gpshead, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 208195dff4cd19dfd4aeb0eed8a133f2b1a66ec1 3.14

Same failure for 3.13. I thought issue might have been in editor.py because an earlier issue added several lines there. After backporting that PR, I tried again but cherry-picker failed again. Issue was in test_zzdummy.py where the swapping of blocks did not get done correctly, leading to an apparent conflict. After I fixed that, cherry_picker could not quite finish so I pushed its corrected backport and made the PR reported below. I will try to backport to 3.13 from the 3.14 backport even though not standard. Otherwise would have to redo conflict resolution.

@terryjreedy terryjreedy added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes and removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 4, 2026
@bedevere-app

bedevere-app Bot commented Jul 4, 2026

Copy link
Copy Markdown

GH-152992 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
@python python deleted a comment from miss-islington-app Bot Jul 4, 2026
terryjreedy added a commit that referenced this pull request Jul 4, 2026
…nfig (GH-28713) (#152992)

Extension keybindings defined in ~/.idlerc/config-extensions.cfg
were silently ignored because GetExtensionKeys, __GetRawExtensionKeys,
and GetExtensionBindings only checked default config.
Fix these to check user config as well, and update the extensions config
dialog to handle user-only extensions correctly.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
(cherry picked from commit 208195d)
terryjreedy added a commit that referenced this pull request Jul 4, 2026
…nfig (GH-28713) (GH-152992) (#152993)

[3.14] gh-89520: Load extension settings and keybindings from user config (GH-28713) (GH-152992)

Extension keybindings defined in ~/.idlerc/config-extensions.cfg
were silently ignored because GetExtensionKeys, __GetRawExtensionKeys,
and GetExtensionBindings only checked default config.
Fix these to check user config as well, and update the extensions config
dialog to handle user-only extensions correctly.

---------
(cherry picked from commit 8a8c8ee)






(cherry picked from commit 208195d)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.13 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants