[New-bugs-announce] [issue1882] py_compile does not follow PEP 0263

Jakub Wilk report at bugs.python.org
Mon Jan 21 11:51:52 CET 2008


New submission from Jakub Wilk:

PEP 0263 allows an encoding declaration in the second line, but
py_compile seems not to recognize such ones:

>>> MODULE = "\n# encoding=UTF-8\nU = u'\xc3\xb3'\n"
>>> f = file('tmp.py', 'w')
>>> f.write(MODULE)
>>> f.close()
>>> from py_compile import compile
>>> compile('tmp.py', 'tmp_buggy.pyc', 'tmp_buggy.py', doraise = True)
>>> import tmp
>>> import tmp_buggy
>>> tmp.U
u'\xf3'
>>> tmp_buggy.U
u'\xc3\xb3'

----------
components: Library (Lib)
messages: 61384
nosy: jwilk
severity: major
status: open
title: py_compile does not follow PEP 0263
type: behavior
versions: Python 2.4, Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1882>
__________________________________


More information about the New-bugs-announce mailing list