From: Victor Stinner Date: Fri, 21 May 2010 10:52:08 +0000 (+0000) Subject: Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the correct X-Git-Tag: v3.2a1~732 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0feec2cb684681139ad81acf4a6a541b57a6274;p=thirdparty%2FPython%2Fcpython.git Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the correct encoding --- diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py index 2c6fb0cb838a..7053fd9398db 100755 --- a/Lib/tabnanny.py +++ b/Lib/tabnanny.py @@ -93,8 +93,11 @@ def check(file): check(fullname) return + with open(file, 'rb') as f: + encoding, lines = tokenize.detect_encoding(f.readline) + try: - f = open(file) + f = open(file, encoding=encoding) except IOError as msg: errprint("%r: I/O Error: %s" % (file, msg)) return diff --git a/Misc/NEWS b/Misc/NEWS index fb9b52c73843..5ac16dfc0759 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -375,7 +375,10 @@ C-API Library ------- -- Issue #4870: Add an `options` attribute to SSL contexts, as well as +- Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the + correct encoding + +- Issue #4870: Add an `options` attribute to SSL contexts, as well as several ``OP_*`` constants to the `ssl` module. This allows to selectively disable protocol versions, when used in combination with `PROTOCOL_SSLv23`.