gh-156896: Stop scrubbing tkinker submodules upon idlelib.run import - #156915
Conversation
…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
There was a problem hiding this comment.
LGTM. 👍
I tried more radical approach -- removing any Tkinter dependency from idlelib.run. But this is complicated due to stackviewer.
|
I hope to further reduce the dependency by further reducing the imports. This is part of the purpose of the util module. |
|
Thanks @terryjreedy for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
Sorry, @terryjreedy, I could not cleanly backport this to |
|
Sorry, @terryjreedy, I could not cleanly backport this to |
|
Sorry, @terryjreedy, I could not cleanly backport this to |
|
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. |
|
Serhiy, the not-backported changes are your. See dicord DM. |
|
GH-156958 is a backport of this pull request to the 3.15 branch. |
|
GH-156959 is a backport of this pull request to the 3.14 branch. |
|
GH-156960 is a backport of this pull request to the 3.13 branch. |
…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>
…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>
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.ttkand check for proper output.