◐ Shell
clean mode source ↗

Issue 4628: No universal newline support for compile() when using bytes

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