Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e2e16e

Browse files
author
Victor Stinner
committed
Merged revisions 81393 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r81393 | victor.stinner | 2010-05-21 12:52:08 +0200 (ven., 21 mai 2010) | 3 lines Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the correct encoding ........
1 parent b78f7f7 commit 8e2e16e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/tabnanny.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ def check(file):
9393
check(fullname)
9494
return
9595

96+
with open(file, 'rb') as f:
97+
encoding, lines = tokenize.detect_encoding(f.readline)
98+
9699
try:
97-
f = open(file)
100+
f = open(file, encoding=encoding)
98101
except IOError as msg:
99102
errprint("%r: I/O Error: %s" % (file, msg))
100103
return

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ Core and Builtins
4646
Library
4747
-------
4848

49+
- Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the
50+
correct encoding
51+
4952
- Issue #7507: Quote "!" in pipes.quote(); it is special to some shells.
5053

5154
- Issue #8663: distutils.log emulates backslashreplace error handler. Fix

0 commit comments

Comments
 (0)