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

Skip to content

Commit f0feec2

Browse files
author
Victor Stinner
committed
Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the correct
encoding
1 parent b521877 commit f0feec2

2 files changed

Lines changed: 8 additions & 2 deletions

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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,10 @@ C-API
375375
Library
376376
-------
377377

378-
- Issue #4870: Add an `options` attribute to SSL contexts, as well as
378+
- Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the
379+
correct encoding
380+
381+
- Issue #4870: Add an `options` attribute to SSL contexts, as well as
379382
several ``OP_*`` constants to the `ssl` module. This allows to selectively
380383
disable protocol versions, when used in combination with `PROTOCOL_SSLv23`.
381384

0 commit comments

Comments
 (0)