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: Make idlelib/run.py runnable.
Type: behavior 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, taleinat, terry.reedy
Priority: normal Keywords: patch

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

Pull Requests
URL Status Linked Edit
PR 13560 merged terry.reedy, 2019-05-24 23:03
PR 13561 merged miss-islington, 2019-05-25 02:18
Messages (5)
msg343433 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-05-24 21:56
Slightly simplified, pyshell.ModifiedInterpreter.built_subprocess runs
f'{sys.executable} -c "__import__('idlelib.run').run.main()"'.
"__import__('idlelib.run')" creates sys.modules['idlelib'] from idlelib/__init__.py, creates sys.modules['idlelib.run'] from idlelib/run.py, binds 'run' to the idlelib.run module in the idlelib module, and returns the idlelib module.  It does not bind any names in the main module of the new process.  '.run' gets the idlelib.run module and '.main()' executes its main function.  This eventually executes user code in the so-far untouched main module.

During the creation of the idlelib.run module, various other idlelib module are imported.  Some of these import both tkinter and its submodules, such as tkinter.font, adding names such as 'font' to the tkinter modules.  To prevent user code running when it should not, these added names are deleted. #25507.

Once the deletion code is run, it will fail with AttributeError if run again, such as from an IDLE editor.  The patch solves this by adding a flag that indicates that the file has already be imported into the process.
msg343449 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-05-25 01:59
New changeset 81bb97df6138c755e229dcdac9bed747e31b61b3 by Terry Jan Reedy in branch 'master':
bpo-37038: Make idlelib.run runnable; add test clause (GH-13560)
https://github.com/python/cpython/commit/81bb97df6138c755e229dcdac9bed747e31b61b3
msg343453 - (view) Author: miss-islington (miss-islington) Date: 2019-05-25 05:10
New changeset c70ab1cca0f43dbf3bad4acacd06a792cdbe03c8 by Miss Islington (bot) in branch '3.7':
bpo-37038: Make idlelib.run runnable; add test clause (GH-13560)
https://github.com/python/cpython/commit/c70ab1cca0f43dbf3bad4acacd06a792cdbe03c8
msg345184 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-06-11 05:49
Terry, I believe this can be closed now that the fix has been merged?
msg345188 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-11 05:54
Yes, thank you.
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81219
2019-06-11 05:54:03terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg345188

stage: patch review -> resolved
2019-06-11 05:49:44taleinatsetnosy: + taleinat
messages: + msg345184
2019-05-25 05:10:13miss-islingtonsetnosy: + miss-islington
messages: + msg343453
2019-05-25 02:18:32miss-islingtonsetpull_requests: + pull_request13472
2019-05-25 01:59:57terry.reedysetmessages: + msg343449
2019-05-24 23:03:11terry.reedysetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request13471
2019-05-24 21:56:19terry.reedycreate