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 <1558734979.99.0.70787522165.issue37038@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-05-24 21:56:20terry.reedysetrecipients: + terry.reedy
2019-05-24 21:56:19terry.reedysetmessageid: <1558734979.99.0.70787522165.issue37038@roundup.psfhosted.org>
2019-05-24 21:56:19terry.reedylinkissue37038 messages
2019-05-24 21:56:19terry.reedycreate