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: Fix starting IDLE with pyshell
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: cheryl.sabella, miss-islington, taleinat, terry.reedy
Priority: normal Keywords: patch

Created on 2019-03-26 03:09 by terry.reedy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12548 merged terry.reedy, 2019-03-26 04:12
PR 12570 merged miss-islington, 2019-03-26 23:58
Messages (7)
msg338847 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-26 03:09
python -m idlelib.pyshell  # and
python f:/dev/3x/lib/idlelib/pyshell.py  # for instance
no longer start IDLE properly.  The separate subprocess startup command for when pyshell is the main, from 2004, is obsolete and no longer needed.  The command needed is the same as for when IDLE is started otherwise.  It works with either method of starting IDLE with pyshell.

In addition, two modules are created from pyshell.py, with names '__main__' and 'idlelib.pyshell'.  The attempt to prevent this should be at the top of the file instead of the bottem and now needs to add 'idlelib.pyshell' instead of 'pyshell'.  The test for this was to (temporarily) add 'print('running')' at the top of the file and see if 'running\n' is printed to the terminal once or twice.

An automated test might be done as follows:
1. Move imports in main(), including that of 'testing', to top of file.
2. Add, for instance, 'if testing: print('running') after the import.
3. Mock main().
4. Use test.support for 'with <captured stdout>: run pyshell.py'.
5. Check captured stdout for exactly one 'running' occurrence.
msg338848 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-26 03:14
The shell actually 'starts', but with an empty box and no prompt.

I am thinking of eventually deprecating and disabling starting with pyshell, but until we do, it should work.  If nothing else, we should be able to display a deprecation notice if that becomes appropriate.

The lack of reports does suggest that most affected people either switched to an approved method or another IDE.
msg338851 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-26 04:15
One can start IDLE from python with import idlelib.idle or import idlelib.__main__ but not by importing pyshell, as there is alread a __main__ module.  I cannot think of anything else to check.
msg338926 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-26 23:58
New changeset 6a258c88906a7e8acde455ee2acb78b6f315ea0b by Terry Jan Reedy in branch 'master':
bpo-36429: Fix starting IDLE with pyshell (#12548)
https://github.com/python/cpython/commit/6a258c88906a7e8acde455ee2acb78b6f315ea0b
msg338928 - (view) Author: miss-islington (miss-islington) Date: 2019-03-27 00:19
New changeset 23eb816399ac7482d2bd7d50814b19a3db52e7d4 by Miss Islington (bot) in branch '3.7':
bpo-36429: Fix starting IDLE with pyshell (GH-12548)
https://github.com/python/cpython/commit/23eb816399ac7482d2bd7d50814b19a3db52e7d4
msg345758 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-06-16 15:10
Terry, it looks like you merged a fix for this. Should this be closed?
msg345766 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-16 19:09
Yep.  I changes the headers but must have neglected to hit [Submit Changes].
History
Date User Action Args
2022-04-11 14:59:13adminsetgithub: 80610
2019-06-16 19:09:00terry.reedysetmessages: + msg345766
2019-06-16 19:07:44terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-06-16 15:10:51taleinatsetnosy: + taleinat
messages: + msg345758
2019-03-27 00:19:26miss-islingtonsetnosy: + miss-islington
messages: + msg338928
2019-03-26 23:58:34miss-islingtonsetpull_requests: + pull_request12515
2019-03-26 23:58:28terry.reedysetmessages: + msg338926
2019-03-26 04:15:38terry.reedysetmessages: + msg338851
2019-03-26 04:12:09terry.reedysetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request12497
2019-03-26 03:14:49terry.reedysetmessages: + msg338848
2019-03-26 03:09:18terry.reedycreate