Does Python 3.1 accept \r\n in compile()?

jmfauth wxjmfauth at gmail.com
Wed Dec 29 16:06:38 EST 2010


On 29 Dez., 21:14, Terry Reedy <tjre... at udel.edu> wrote:
> On 12/29/2010 2:31 PM, Terry Reedy wrote:
>
> > "Changed in version 3.2: Allowed use of Windows and Mac newlines. Also
> > input in 'exec' mode does not have to end in a newline anymore. Added
> > the optimize parameter."
>
> Retest shows that above is correct.
>
>  >>> compile("print(999)\r\n", "blah", "exec")
>
> <code object <module> at 0x00F5EC50, file "blah", line 1>
>

Ok, I see. Thanks.

The '\r\n' acceptance has been introduced in Python 2.7
and I was a little bit suprised with Python 3.1.

For the story, I'm not using directly the compile()
command, but something like:

<my_interactive_interpreter_instance>.runsource(source)

where source is coming from a GUI toolkit text widget.





More information about the Python-list mailing list