diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-11-09 01:08:59 +0000 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-11-09 01:08:59 +0000 |
commit | bad53dcd4f90cab0d2c985f8c357b68ac7f53eda (patch) | |
tree | 26b050626cddcc3155c7ca3eff137d064b0f1b32 /Lib/tabnanny.py | |
parent | 2563f8d59a0535a2725d647ca46da3b06fa4a47b (diff) | |
download | cpython-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-x | Lib/tabnanny.py | 5 |
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 |