FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-156896: Stop scrubbing tkinker submodules upon idlelib.run import by terryjreedy · Pull Request #156915 · python/cpython · GitHub

Repository navigation

gh-156896: Stop scrubbing tkinker submodules upon idlelib.run import - #156915

Merged
terryjreedy merged 1 commit into
python:mainfrom
terryjreedy:run_import
Sep 4, 2026
Merged

terryjreedy merged 1 commit into
python:mainfrom
terryjreedy:run_import

Conversation

terryjreedy commented Sep 4, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

Instead, invoke the scrubbing within run.main, which is called after the import when starting the IDLE user process.

To manually test that scrub_tkinter_submodules is called when proper, start (or restart) Shell, enter `import tkinter; dir(tkinter), and check that that font, messagebox, ttk, and the dialog modules are missing.

It is obvious from the code that the function is not otherwise called. To test anyway, continue with import tkinter.ttk; import idlelib.run; tkinter.ttk and check for proper output.

…mport

Instead, invoke the scrubbing within run.main, which is called after
the import when starting the IDLE user process.

To manually test that scrub_tkinter_submodules
is called when proper, start (or restart) Shell, enter
`import tkinter; dir(tkinter), and check that that font,
messagebox, ttk, and the dialog modules are missing.

It is obvious from the code that the function is not otherwise
called.  To test anyway, continue with `import tkinter.ttk;
import idlelib.run; tkinter.ttk` and check for proper output.

serhiy-storchaka 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. 👍

I tried more radical approach -- removing any Tkinter dependency from idlelib.run. But this is complicated due to stackviewer.

Copy link
Copy Markdown
Member Author

I hope to further reduce the dependency by further reducing the imports. This is part of the purpose of the util module.

terryjreedy merged commit e50d233 into python:main Sep 4, 2026
65 checks passed

Copy link
Copy Markdown

Thanks @terryjreedy for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @terryjreedy, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e50d23389be07bf702bde74c3cda794c6febb53e 3.15

Copy link
Copy Markdown

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

cherry_picker e50d23389be07bf702bde74c3cda794c6febb53e 3.14

Copy link
Copy Markdown

Sorry, @terryjreedy, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e50d23389be07bf702bde74c3cda794c6febb53e 3.13

terryjreedy commented Sep 4, 2026 •
edited
Loading

Copy link
Copy Markdown
Member Author

The gh-59396 additions in lines 34 to 44 (prior to this patch) were not backported. I will do that later and these backports should then work.

terryjreedy deleted the run_import branch September 4, 2026 11:27

Copy link
Copy Markdown
Member Author

Serhiy, the not-backported changes are your. See dicord DM.

bedevere-app Bot commented Sep 4, 2026

Copy link
Copy Markdown

GH-156958 is a backport of this pull request to the 3.15 branch.

bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Sep 4, 2026

bedevere-app Bot commented Sep 4, 2026

Copy link
Copy Markdown

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

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 4, 2026

bedevere-app Bot commented Sep 4, 2026

Copy link
Copy Markdown

GH-156960 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label Sep 4, 2026
terryjreedy added a commit that referenced this pull request Sep 4, 2026
…import (GH-156915) (#156959)

gh-156896: Stop scrubbing tkinter submodules upon idlelib.run import (#156915)

Instead, invoke the scrubbing within run.main, which is called after
the import when starting the IDLE user process.

To manually test that scrub_tkinter_submodules
is called when proper, start (or restart) Shell, enter
`import tkinter; dir(tkinter), and check that that font,
messagebox, ttk, and the dialog modules are missing.

It is obvious from the code that the function is not otherwise
called.  To test anyway, continue with `import tkinter.ttk;
import idlelib.run; tkinter.ttk` and check for proper output.

(cherry picked from commit e50d233)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
terryjreedy added a commit that referenced this pull request Sep 4, 2026
…import (GH-156915) (#156960)

gh-156896: Stop scrubbing tkinter submodules upon idlelib.run import (#156915)

Instead, invoke the scrubbing within run.main, which is called after
the import when starting the IDLE user process.

To manually test that scrub_tkinter_submodules
is called when proper, start (or restart) Shell, enter
`import tkinter; dir(tkinter), and check that that font,
messagebox, ttk, and the dialog modules are missing.

It is obvious from the code that the function is not otherwise
called.  To test anyway, continue with `import tkinter.ttk;
import idlelib.run; tkinter.ttk` and check for proper output.

(cherry picked from commit e50d233)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
python deleted a comment from bedevere-bot Sep 5, 2026
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
…mport (python#156915)

Instead, invoke the scrubbing within run.main, which is called after
the import when starting the IDLE user process.

To manually test that scrub_tkinter_submodules
is called when proper, start (or restart) Shell, enter
`import tkinter; dir(tkinter), and check that that font,
messagebox, ttk, and the dialog modules are missing.

It is obvious from the code that the function is not otherwise
called.  To test anyway, continue with `import tkinter.ttk;
import idlelib.run; tkinter.ttk` and check for proper output.
terryjreedy added a commit that referenced this pull request Oct 9, 2026
…import (GH-156915) (#156958)

gh-156896: Stop scrubbing tkinter submodules upon idlelib.run import (#156915)

Instead, invoke the scrubbing within run.main, which is called after
the import when starting the IDLE user process.

To manually test that scrub_tkinter_submodules
is called when proper, start (or restart) Shell, enter
`import tkinter; dir(tkinter), and check that that font,
messagebox, ttk, and the dialog modules are missing.

It is obvious from the code that the function is not otherwise
called.  To test anyway, continue with `import tkinter.ttk;
import idlelib.run; tkinter.ttk` and check for proper output.

(cherry picked from commit e50d233)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL