summaryrefslogtreecommitdiffstats
path: root/Lib/tabnanny.py
diff options
context:
space:
mode:
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 2c6fb0c..7053fd9 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