[New-bugs-announce] [issue4628] No universal newline support for compile() when using bytes

Brett Cannon report at bugs.python.org
Thu Dec 11 07:54:07 CET 2008


New submission from Brett Cannon <brett at python.org>:

Passing in bytes to compile() works well for letting the parser handle
the decoding of a file when an encoding is specified, but it doesn't
take care of universal newlines::

 >>> source = b'a = 1\r\nb = 2\r\n'
 >>> compile(source, '<test>', 'exec')
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "<test>", line 1
     a = 1
         ^
 SyntaxError: invalid syntax

----------
components: Interpreter Core
messages: 77596
nosy: brett.cannon
severity: normal
stage: needs patch
status: open
title: No universal newline support for compile() when using bytes
type: behavior
versions: Python 3.0

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


More information about the New-bugs-announce mailing list