This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients donmez, georg.brandl, pitrou, vstinner
Date 2010-11-09.16:22:40
SpamBayes Score 2.0471643e-06
Marked as misclassified No
Message-id <1289319763.44.0.311316741809.issue10372@psf.upfronthosting.co.za>
In-reply-to
Content
Weirdly, this patch fixes the issue, but I'm unable to say why:


diff -r cd1de1ff2657 Lib/tokenize.py
--- a/Lib/tokenize.py   Tue Nov 09 02:08:59 2010 +0100
+++ b/Lib/tokenize.py   Tue Nov 09 17:16:21 2010 +0100
@@ -24,12 +24,12 @@ __author__ = 'Ka-Ping Yee <ping@lfw.org>
 __credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
                'Skip Montanaro, Raymond Hettinger, Trent Nelson, '
                'Michael Foord')
+import io
 import re
 import sys
 from token import *
 from codecs import lookup, BOM_UTF8
 import collections
-from io import TextIOWrapper
 cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
 
 import token
@@ -336,16 +336,14 @@ def detect_encoding(readline):
     return default, [first, second]
 
 
-_builtin_open = open
-
 def open(filename):
     """Open a file in read only mode using the encoding detected by
     detect_encoding().
     """
-    buffer = _builtin_open(filename, 'rb')
+    buffer = io.open(filename, 'rb')
     encoding, lines = detect_encoding(buffer.readline)
     buffer.seek(0)
-    text = TextIOWrapper(buffer, encoding, line_buffering=True)
+    text = io.TextIOWrapper(buffer, encoding, line_buffering=True)
     text.mode = 'r'
     return text
History
Date User Action Args
2010-11-09 16:22:43pitrousetrecipients: + pitrou, georg.brandl, vstinner, donmez
2010-11-09 16:22:43pitrousetmessageid: <1289319763.44.0.311316741809.issue10372@psf.upfronthosting.co.za>
2010-11-09 16:22:41pitroulinkissue10372 messages
2010-11-09 16:22:40pitroucreate