Issue 4628: No universal newline support for compile() when using bytes
Created on 2008-12-11 06:54 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg77596 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2008-12-11 06:54 | |
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
|
|||
| msg83847 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2009-03-20 01:58 | |
This problem is not new. exec() in Python 2.x doesn't accept \r\n newlines. See also related(?) issue: #5524 |
|||
| msg84127 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2009-03-24 23:44 | |
See also related issue: #4377 (tokenize.detect_encoding() and Mac newline). |
|||
| msg95164 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2009-11-12 23:40 | |
Finally got around to fixing this. r76230 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:42 | admin | set | github: 48878 |
| 2009-11-12 23:40:16 | benjamin.peterson | set | status: open -> closed nosy:
+ benjamin.peterson resolution: fixed |
| 2009-03-24 23:44:28 | vstinner | set | messages: + msg84127 |
| 2009-03-21 10:51:36 | vstinner | link | issue4282 dependencies |
| 2009-03-21 10:48:16 | vstinner | link | issue5524 dependencies |
| 2009-03-20 01:58:31 | vstinner | set | nosy:
+ vstinner messages: + msg83847 |
| 2008-12-11 06:54:06 | brett.cannon | create | |
