summaryrefslogtreecommitdiffstats
path: root/Lib/tabnanny.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-21 10:53:32 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-21 10:53:32 (GMT)
commit8e2e16e95e1132cdde9a64bcfc1d27120079c749 (patch)
tree6086326777154085abc122c60f429a83a018914f /Lib/tabnanny.py
parentb78f7f7db09f42efa400de15893fb2bffafdc6cc (diff)
downloadcpython-8e2e16e95e1132cdde9a64bcfc1d27120079c749.zip
cpython-8e2e16e95e1132cdde9a64bcfc1d27120079c749.tar.gz
cpython-8e2e16e95e1132cdde9a64bcfc1d27120079c749.tar.bz2
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 ........
Diffstat (limited to 'Lib/tabnanny.py')
-rwxr-xr-xLib/tabnanny.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py
index 0ae5e9f..3a8cd37 100755
--- a/Lib/tabnanny.py
+++ b/Lib/tabnanny.py
@@ -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