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.

Author terry.reedy
Recipients terry.reedy
Date 2019-05-24.21:56:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Slightly simplified, pyshell.ModifiedInterpreter.built_subprocess runs
f'{sys.executable} -c "__import__('').run.main()"'.
"__import__('')" creates sys.modules['idlelib'] from idlelib/, creates sys.modules[''] from idlelib/, binds 'run' to the 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 module and '.main()' executes its main function.  This eventually executes user code in the so-far untouched main module.

During the creation of the 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.
Date User Action Args
2019-05-24 21:56:20terry.reedysetrecipients: + terry.reedy
2019-05-24 21:56:19terry.reedysetmessageid: <>
2019-05-24 21:56:19terry.reedylinkissue37038 messages
2019-05-24 21:56:19terry.reedycreate