From: Victor Stinner Date: Fri, 21 May 2010 10:53:32 +0000 (+0000) Subject: Merged revisions 81393 via svnmerge from X-Git-Tag: v3.1.3rc1~730 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e2e16e95e1132cdde9a64bcfc1d27120079c749;p=python Merged revisions 81393 via svnmerge from svn+ssh://pythondev@svn.python.org/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 ........ --- diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py index 0ae5e9f0df..3a8cd373be 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 66433e4f01..f52ec6d381 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -46,6 +46,9 @@ Core and Builtins Library ------- +- Issue #8774: tabnanny uses the encoding cookie (#coding:...) to use the + correct encoding + - Issue #7507: Quote "!" in pipes.quote(); it is special to some shells. - Issue #8663: distutils.log emulates backslashreplace error handler. Fix