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 perilbrain
Recipients Bruce.Sherwood, THRlWiTi, bsherwood, perilbrain, roger.serwy, terry.reedy
Date 2016-11-02.08:01:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
"To run without saving" was the first idea I got, but it was difficult to pursue in first phase. After your hints I think I have achieved what you have described.

I have done a few fixes(luckily in a single file which are giving satisfactory result.

I am attaching the original, modified and the diff version of files named, and ScriptBinding.diff respectively. 

Here is what I am getting with the new code
Traceback (most recent call last):
  File "*Untitled*", line 3, in <module>
  File "*Untitled*", line 2, in f
ZeroDivisionError: division by zero

This is the summary of the patch (idle-python3.4)

+import io

#====== One member in class for reducing annoyance ====
        self.no_save = False

#====== New definition for function tabnanny======
-    def tabnanny(self, filename):
+    def tabnanny(self, source):
+        f = io.StringIO(source)# , os.linesep  *****Maybe*****
-        with as f:

#====== Added 2 functions =========
    def source_from_file(self, filename):
        with open(filename, 'rb') as f:
            source =
        if b'\r' in source:
            source = source.replace(b'\r\n', b'\n')
            source = source.replace(b'\r', b'\n')
        if source and source[-1] != ord(b'\n'):
            source = source + b'\n'
        return source
    def source_from_editor(self):
        source = self.editwin.text.get("1.0", "end-1c")
        return source

#====== New definition for function checksyntax======
-    def checksyntax(self, filename):
+    def checksyntax(self, source, filename):

#====== Changes in function run_module_event (Main) ==========
    def _run_module_event(self, event):
        filename = self.getfilename()
        filename = self.getfilename()
        if not filename:
            self.no_save = True
            source = self.source_from_editor()
            filename =
            source = self.source_from_file(filename)
            self.no_save = False
        code = self.checksyntax(source, filename)
        if not code:
            return 'break'
        if not self.tabnanny(source):
            return 'break'
        interp =
        if PyShell.use_subprocess:
        if not self.no_save:
        return 'break'

#====== Finally suppressing the annoyance ======
            if autosave and filename:
            elif self.no_save:
                filename = None
                confirm = self.ask_save_dialog()

Please have a review and let me know if it can solve this issue.
Date User Action Args
2016-11-02 08:01:48perilbrainsetrecipients: + perilbrain, terry.reedy, bsherwood, roger.serwy, THRlWiTi, Bruce.Sherwood
2016-11-02 08:01:48perilbrainsetmessageid: <>
2016-11-02 08:01:47perilbrainlinkissue19042 messages
2016-11-02 08:01:47perilbraincreate