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 Bruce.Sherwood, THRlWiTi, bsherwood, roger.serwy, terry.reedy
Date 2016-11-02.05:16:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Duplicate #28581 has a autosave patch in the initial post, which points out that "We are often required to copy code from various sites say some tutorial or code samples which are good for one time usage."

It prompted me to think more about the idea to 'add a mechanism to truly run without saving [to disk]', which I mentioned in my first post above.  To run editor code, IDLE retrieves the code from the Text widget as a single strings; runs compile(code, 'filename', 'exec'), ships the code object to the user process, and runs exec(code, fakemain).  (I understand this much better now than 3 years ago.)  The only use of the disk copy is for tracebacks.  But is it *needed*?  I believe not.  Here is standard interactive Python (3.5.2):

>>> def f():
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
ZeroDivisionError: division by zero

Here is the same traceback in IDLE's Shell:

Traceback (most recent call last):
  File "<pyshell#40>", line 1, in <module>
  File "<pyshell#39>", line 2, in f
ZeroDivisionError: division by zero

IDLE has filled in the missing lines from Shell's text.  I have not yet tracked where this is done (in, I believe), but I presume it could do the same for Untitled editor windows.  For this to work, the window titles should be Untitled-0, Untitled-1, ... .  The specific name used in the compile call would appear in the traceback, to be used to lookup the window the code came from.

With the ability to run the whole buffer without saving, it would be easy to run a selection.  (There have been multiple requests for this.)

IDLE already asks about saving when one tried to close a window with unsaved text, so there is no need to force saving when running for this purpose.
Date User Action Args
2016-11-02 05:16:56terry.reedysetrecipients: + terry.reedy, bsherwood, roger.serwy, THRlWiTi, Bruce.Sherwood
2016-11-02 05:16:55terry.reedysetmessageid: <>
2016-11-02 05:16:55terry.reedylinkissue19042 messages
2016-11-02 05:16:54terry.reedycreate