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 | 58c0752a33253641c1423fac2d4ef3f623fbcb46 (patch) | |
| tree | 2e2ada02342f78d3cc58a4fe23082818c4025b1b /Lib/tabnanny.py | |
| parent | ae4836df6d0ea92d778ef30bd37417d048fc37fc (diff) | |
| download | cpython-git-58c0752a33253641c1423fac2d4ef3f623fbcb46.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 |
