[Python-checkins] r81393 - in python/branches/py3k: Lib/tabnanny.py Misc/NEWS

victor.stinner python-checkins at python.org
Fri May 21 12:52:08 CEST 2010


Author: victor.stinner
Date: Fri May 21 12:52:08 2010
New Revision: 81393

Log:
Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the correct
encoding


Modified:
   python/branches/py3k/Lib/tabnanny.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/tabnanny.py
==============================================================================
--- python/branches/py3k/Lib/tabnanny.py	(original)
+++ python/branches/py3k/Lib/tabnanny.py	Fri May 21 12:52:08 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/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Fri May 21 12:52:08 2010
@@ -375,7 +375,10 @@
 Library
 -------
 
-- Issue #4870: Add an `options` attribute to SSL contexts, as well as 
+- Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the
+  correct encoding
+
+- Issue #4870: Add an `options` attribute to SSL contexts, as well as
   several ``OP_*`` constants to the `ssl` module.  This allows to selectively
   disable protocol versions, when used in combination with `PROTOCOL_SSLv23`.
 


More information about the Python-checkins mailing list