summaryrefslogtreecommitdiffstats
path: root/Lib/tabnanny.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-11-09 01:08:59 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-11-09 01:08:59 (GMT)
commit58c0752a33253641c1423fac2d4ef3f623fbcb46 (patch)
tree2e2ada02342f78d3cc58a4fe23082818c4025b1b /Lib/tabnanny.py
parentae4836df6d0ea92d778ef30bd37417d048fc37fc (diff)
downloadcpython-58c0752a33253641c1423fac2d4ef3f623fbcb46.zip
cpython-58c0752a33253641c1423fac2d4ef3f623fbcb46.tar.gz
cpython-58c0752a33253641c1423fac2d4ef3f623fbcb46.tar.bz2
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 7053fd9..a4d4ef0 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