classification
Title: python3 py_compile does not ignore UTF-8 BOM characters
Type: Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, koobs, ned.deily
Priority: normal Keywords:

Created on 2010-03-18 10:43 by ned.deily, last changed 2014-02-21 13:44 by koobs. This issue is now closed.

Messages (3)
msg101257 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-03-18 10:42
$ cat bom3.py
# coding: utf-8
print("BOM BOOM!")
$ file bom3.py 
bom3.py: UTF-8 Unicode (with BOM) text
$ python3.1
Python 3.1.1+ (r311:74480, Jan 20 2010, 00:37:31) 
[GCC 4.4.3 20100108 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bom3
BOM BOOM!
>>> import py_compile
>>> py_compile.compile("bom3.py")
  File "bom3.py", line 1
    # coding: utf-8
      ^
SyntaxError: invalid character in identifier

The same test does not fail with python2.6.4.
(Same results on OS X.)
msg101288 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-03-18 22:39
Fixed in r79068.
msg211859 - (view) Author: koobs (koobs) Date: 2014-02-21 13:44
Breadcrumb: this was reported against 3.2 and 3.1, but never backported to the latter.
History
Date User Action Args
2014-02-21 13:44:14koobssetnosy: + koobs
messages: + msg211859
2010-03-18 22:39:30benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg101288

resolution: fixed
2010-03-18 10:43:00ned.deilycreate