]> granicus.if.org Git - python/commitdiff
Merged revisions 81393 via svnmerge from
authorVictor Stinner <victor.stinner@haypocalc.com>
Fri, 21 May 2010 10:53:32 +0000 (10:53 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Fri, 21 May 2010 10:53:32 +0000 (10:53 +0000)
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
........

Lib/tabnanny.py
Misc/NEWS

index 0ae5e9f0df2f8966eb4f7620656cf95258822c76..3a8cd373be103fcc55e9db32500c7a56e3a2655c 100755 (executable)
@@ -93,8 +93,11 @@ def check(file):
                 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
index 66433e4f01831b65553927e1718865df579676b2..f52ec6d381a57b50269b7881f3cd70faf092dc13 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,9 @@ Core and Builtins
 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