Title: IDLE: unrequested pasting into Shell after restart
Type: behavior Stage: needs patch
Components: IDLE Versions: Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, rhettinger, taleinat, terry.reedy
Priority: normal Keywords:

Created on 2018-12-12 02:32 by terry.reedy, last changed 2019-03-20 16:37 by terry.reedy.

Messages (5)
msg331668 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-12 02:32
IDLE very occasionally (frequency much less than .01), and AFAIK hapzardly, pastes previous shell output after I enter something at the prompt after a restart.  Not fatal but definitly annoying.  When it happened today, I decided to open this issue to start accumulating information that might point at where to start.  (content likely not relevant)

import inspect
class A:

Shell copy:
OSError: could not find class definition
======================== RESTART: F:\Python\a\ ========================
class A:

>>> 1/0======================== RESTART: F:\Python\a\ ========================
class A:
SyntaxError: invalid syntax
>>> 1/0
Traceback (most recent call last):

The paste, after '1/0', is the restart line and the first two lines of output (but not the last two).  It mixes text from IDLE and from the program, so it is not an echo from the run process).  It is colored as if typed in: 'class' and 'pass' are keyword colored, the  I believe I hit ENTER  and got the paste instead of the exception.  I hit Entere after the paste to get the SyntaxError and a clean prompt.  Then I reentered 1/0.

I did more or less the same thing about 5 times without a repeat of the problem.

Possible factors:
exception before restart (probably not relevant).
restart, prompt, and entry (I believe these are essential elements).
running a file (I seldom restart other wise).
hitting return

Included Content:
restart line (I am pretty sure pasted text does not always include this).
output from before the restart (ever?).
output from after the restart (if always, must have run a file).

Raymond, I believe you have seen this on Mac.  Tal or Sheryl, how about linux?  Anyone, more details on other examples are needed to know what is constant and what is incidental.
msg331723 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-12-13 00:29
I don't believe I've seen this happen, but I'll watch for it.  One thing that I noticed while trying to recreate it is that I can press F5 on the Shell window even though there isn't a Run menu.  Maybe the issue is somehow related using shortcuts that aren't defined for Shell.
msg331737 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-13 03:30
Thank you for the report.  Since I expect you would recognize the issue if you had seen it, I consider it possible that linux IDLE is immune.

After running a file, I would like f5 to re-run the same file.  Trying to run the contents of Shell, starting with the start-up message, is laughably useless.
msg331738 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-12-13 03:41
FWIW, I have this problem every day.  Am running on macOS.  This behavior has been seen for years and still persists on the latest IDLE that ships with a stock 3.7.1 from
msg331741 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-12-13 05:37
Raymond: I agree that daily would be obnoxious.  For me it is more like once a month or maybe less.  Can you give any detail about the factors I mentioned?  I currently have no idea where to start looking.
Date User Action Args
2019-03-20 16:37:01terry.reedysetassignee: terry.reedy
components: + IDLE
2018-12-13 05:37:30terry.reedysetmessages: + msg331741
2018-12-13 03:41:01rhettingersetmessages: + msg331738
2018-12-13 03:30:12terry.reedysetmessages: + msg331737
2018-12-13 00:29:11cheryl.sabellasetmessages: + msg331723
2018-12-12 02:32:04terry.reedycreate