[Python-checkins] cpython (2.7): Issue #3832: backport 677a9326b4d4 to 2.7 (and delete some obsolete code).

terry.reedy python-checkins at python.org
Mon Oct 6 06:14:05 CEST 2014


https://hg.python.org/cpython/rev/69cdf71bda12
changeset:   92833:69cdf71bda12
branch:      2.7
parent:      92815:ae64614b66b7
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Mon Oct 06 00:13:51 2014 -0400
summary:
  Issue #3832: backport 677a9326b4d4 to 2.7 (and delete some obsolete code).

files:
  Lib/idlelib/IOBinding.py |  14 +++++++-------
  1 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -19,11 +19,7 @@
 
 from idlelib.configHandler import idleConf
 
-try:
-    from codecs import BOM_UTF8
-except ImportError:
-    # only available since Python 2.3
-    BOM_UTF8 = '\xef\xbb\xbf'
+from codecs import BOM_UTF8
 
 # Try setting the locale, so that we can find out
 # what encoding to use
@@ -532,6 +528,8 @@
         ("All files", "*"),
         ]
 
+    defaultextension = '.py' if sys.platform == 'darwin' else ''
+
     def askopenfile(self):
         dir, base = self.defaultfilename("open")
         if not self.opendialog:
@@ -557,8 +555,10 @@
     def asksavefile(self):
         dir, base = self.defaultfilename("save")
         if not self.savedialog:
-            self.savedialog = tkFileDialog.SaveAs(master=self.text,
-                                                  filetypes=self.filetypes)
+            self.savedialog = tkFileDialog.SaveAs(
+                    master=self.text,
+                    filetypes=self.filetypes,
+                    defaultextension=self.defaultextension)
         filename = self.savedialog.show(initialdir=dir, initialfile=base)
         if isinstance(filename, unicode):
             filename = filename.encode(filesystemencoding)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list