[New-bugs-announce] [issue16965] 2to3 should rewrite execfile() to open in 'rb' mode

Barry A. Warsaw report at bugs.python.org
Mon Jan 14 19:24:06 CET 2013


New submission from Barry A. Warsaw:

In this distribute bug I describe a problem when pip installing mimeparse, which has a setup.py with a BOM.  distribute uses execfile() which gets fixed in Python 3 to use a combination of compile(open()) as the fixer.

https://bitbucket.org/tarek/distribute/issue/349/dont-rely-on-2to3-to-properly-rewrite

I think the problem is that the fixer opens the file in text mode, which leaves the BOM as a bogus first character, causing the SyntaxError.  Instead, if the fixer opened the file in binary mode, then the BOM would be handled correctly by compile().

----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 179964
nosy: barry
priority: normal
severity: normal
status: open
title: 2to3 should rewrite execfile() to open in 'rb' mode
versions: Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16965>
_______________________________________


More information about the New-bugs-announce mailing list