summaryrefslogtreecommitdiff
path: root/Lib/tabnanny.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-11-09 01:08:59 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-11-09 01:08:59 +0000
commitbad53dcd4f90cab0d2c985f8c357b68ac7f53eda (patch)
tree26b050626cddcc3155c7ca3eff137d064b0f1b32 /Lib/tabnanny.py
parent2563f8d59a0535a2725d647ca46da3b06fa4a47b (diff)
downloadcpython-bad53dcd4f90cab0d2c985f8c357b68ac7f53eda.tar.gz
Issue #10335: Add tokenize.open(), detect the file encoding using
tokenize.detect_encoding() and open it in read only mode.
Diffstat (limited to 'Lib/tabnanny.py')
-rwxr-xr-xLib/tabnanny.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py
index 7053fd9398..a4d4ef0da0 100755
--- a/Lib/tabnanny.py
+++ b/Lib/tabnanny.py
@@ -93,11 +93,8 @@ def check(file):
check(fullname)
return
- with open(file, 'rb') as f:
- encoding, lines = tokenize.detect_encoding(f.readline)
-
try:
- f = open(file, encoding=encoding)
+ f = tokenize.open(file)
except IOError as msg:
errprint("%r: I/O Error: %s" % (file, msg))
return