homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: No universal newline support for compile() when using bytes
Type: behavior Stage: needs patch
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, brett.cannon, vstinner
Priority: normal Keywords:

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) * (Python committer) 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) * (Python committer) 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) * (Python committer) Date: 2009年03月24日 23:44
See also related issue: #4377 (tokenize.detect_encoding() and Mac 
newline).
msg95164 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009年11月12日 23:40
Finally got around to fixing this. r76230 
History
Date User Action Args
2022年04月11日 14:56:42adminsetgithub: 48878
2009年11月12日 23:40:16benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg95164

resolution: fixed
2009年03月24日 23:44:28vstinnersetmessages: + msg84127
2009年03月21日 10:51:36vstinnerlinkissue4282 dependencies
2009年03月21日 10:48:16vstinnerlinkissue5524 dependencies
2009年03月20日 01:58:31vstinnersetnosy: + vstinner
messages: + msg83847
2008年12月11日 06:54:06brett.cannoncreate

AltStyle によって変換されたページ (->オリジナル) /