[Python-checkins] r81394 - in python/branches/release31-maint: Lib/tabnanny.py Misc/NEWS

victor.stinner python-checkins at python.org
Fri May 21 12:53:33 CEST 2010


Author: victor.stinner
Date: Fri May 21 12:53:32 2010
New Revision: 81394

Log:
Merged revisions 81393 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r81393 | victor.stinner | 2010-05-21 12:52:08 +0200 (ven., 21 mai 2010) | 3 lines
  
  Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the correct
  encoding
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/tabnanny.py
   python/branches/release31-maint/Misc/NEWS

Modified: python/branches/release31-maint/Lib/tabnanny.py
==============================================================================
--- python/branches/release31-maint/Lib/tabnanny.py	(original)
+++ python/branches/release31-maint/Lib/tabnanny.py	Fri May 21 12:53:32 2010
@@ -93,8 +93,11 @@
                 check(fullname)
         return
 
+    with open(file, 'rb') as f:
+        encoding, lines = tokenize.detect_encoding(f.readline)
+
     try:
-        f = open(file)
+        f = open(file, encoding=encoding)
     except IOError as msg:
         errprint("%r: I/O Error: %s" % (file, msg))
         return

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Fri May 21 12:53:32 2010
@@ -46,6 +46,9 @@
 Library
 -------
 
+- Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the
+  correct encoding
+
 - Issue #7507: Quote "!" in pipes.quote(); it is special to some shells.
 
 - Issue #8663: distutils.log emulates backslashreplace error handler. Fix


More information about the Python-checkins mailing list