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: IDLE: "restart shell" while receiving output disables program
Type: behavior Stage: needs patch
Components: IDLE Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: capsicumw, taleinat, terry.reedy
Priority: normal Keywords:

Created on 2021-10-05 19:11 by capsicumw, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg403259 - (view) Author: A A (capsicumw) Date: 2021-10-05 19:11
Idle3 with python 3.7.3 on Debian Buster and XFCE.
Attempting to run the line 'print ("Hello World" * 8**8)' from either the Idle shell window or Idle editor will cause Idle to hang and one CPU core runs 100%.(allowed it to run for several minutes) 
ctl+c or menu Shell>interrupt execution simply pauses CPU processing but does not terminate the process nor is there an option to continue the process. Following this interrupt with use of menu Shell>Restart-shell causes Idle to fully freeze and then requires a system terminate signal to close Idle.
The same line of python used in Idle on another student's MS-Windows laptop required ctl-alt-del this was a fresh download with v3.9 as I recall.

When used used on the system Bash shell and python 3.7.3, the line operates without any trouble and finishes in 20seconds as: $ python3 -c 'print ( "Hello World " * 8**8)' 

Suggestion is that the ctl+c or the Interrupt menu option in Idle should terminate the running code rather than pause it.
msg403284 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-10-06 02:17
IDLE uses tk/tkinter text widgets for Editor and Shell windows.  A known downside of this is that long lines, greater than about 2000 chars, slow down scrolling. See #1442493 for instance.

Part of the Squeezer feature was meant to alleviate this by squeezing long lines as well as many lines.  This was meant to be documented but the main sentence is garbled a bit and needs to be rewritten.  Squeezer can be partly deactivated by raising the threshhold to, for instance, 1_000_000_000.

Another feature of IDLE is that is executes user code in a separate process, sending user code output back to the GUI process through a socket.  Massive amounts of output are noticeably slower than in the terminal/console.  This can be eliminated by starting IDLE with -n.

On my machine, 'a'*n takes about 1 second per 133_333 chars, or 12 for 1.6M.  160M would take 1200 seconds or 20 minutes.  This of course, has nothing to do with any normal use of IDLE.

Keyboard Interrupt, Ctrl-C: It is a known CPython (not IDLE) issue (discussed on the tracker) that this does not always interrupt execution of user code.  This may depend on the OS.  On my machine, I see

'a'*1_600_000  # hit ^C during 12 second wait.
[Squeezed text (20001 lines.)] Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    'a'*1_600_000
KeyboardInterrupt

This is not supposed to terminate the execution process, but merely to end execution of the statement.  A prompt for another statement should be and for me is displayed.  For me, following the above with restart Ctrl-F6 works normally.

However, Restart during the wait, with or without ^c, puts IDLE into a recoverable state.  Since Restart during time.sleep or 'while True: pass' work, I suspect the issue is restarting while receiving input.
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89544
2021-10-06 02:20:00terry.reedysettitle: IDLE cannot kill process. "interupt" ctl+c and "restart shell" freeze program. -> IDLE: "restart shell" while receiving output disables program
stage: needs patch
versions: + Python 3.11, - Python 3.7
2021-10-06 02:17:55terry.reedysetnosy: + taleinat
messages: + msg403284
2021-10-05 19:11:17capsicumwcreate