[Python-Dev] Compile() and Windows/Mac newlines
In python-list thread Does Python 3.1 accept \r\n in compile()? jmfauth notes that compile('print(999)\r\n', 'in', 'exec') works in 2.7 but not 3.1 (and 3.2 not checked) because 3.1 sees '\r' as SyntaxError. I started to respond that this is part of Py3 cleanup with newlines converted on input and back-compatibility with ancient Python not needed. Then I saw in 3.2 manual 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. I verified second statement (print(999) works) (and remember commit for third), but original above gives same error. Should Allowed use of Windows and Mac newlines. be deleted? What else could it mean other than use of '\r' or '\r\n'? -- Terry Jan Reedy ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Compile() and Windows/Mac newlines
2010/12/29 Terry Reedy tjre...@udel.edu: In python-list thread Does Python 3.1 accept \r\n in compile()? jmfauth notes that compile('print(999)\r\n', 'in', 'exec') works in 2.7 but not 3.1 (and 3.2 not checked) because 3.1 sees '\r' as SyntaxError. I started to respond that this is part of Py3 cleanup with newlines converted on input and back-compatibility with ancient Python not needed. Then I saw in 3.2 manual 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. I verified second statement (print(999) works) (and remember commit for third), but original above gives same error. Should Allowed use of Windows and Mac newlines. be deleted? What else could it mean other than use of '\r' or '\r\n'? $ ./python Python 3.2b2 (py3k:87559, Dec 28 2010, 17:39:51) [GCC 4.4.4] on linux2 Type help, copyright, credits or license for more information. compile(print(999)\r\n, blah, exec) code object module at 0xb353e8, file blah, line 1 -- Regards, Benjamin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Compile() and Windows/Mac newlines
On 12/29/2010 2:31 PM, Terry Reedy wrote: In python-list thread Does Python 3.1 accept \r\n in compile()? jmfauth notes that compile('print(999)\r\n', 'in', 'exec') works in 2.7 but not 3.1 (and 3.2 not checked) because 3.1 sees '\r' as SyntaxError. I started to respond that this is part of Py3 cleanup with newlines converted on input and back-compatibility with ancient Python not needed. Then I saw in 3.2 manual 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. I verified second statement (print(999) works) (and remember commit for third), but original above gives same error. Should Allowed use of Windows and Mac newlines. be deleted? What else could it mean other than use of '\r' or '\r\n'? After tracing the questioned comment to B.Peterson's r76232 merged from 2.7 r76230 fix several compile() issues by translating newlines in the tokenizer, I decided to open http://bugs.python.org/issue10792 -- Terry Jan Reedy ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Compile() and Windows/Mac newlines
On 12/29/2010 2:53 PM, Benjamin Peterson wrote: Type help, copyright, credits or license for more information. compile(print(999)\r\n, blah, exec) code objectmodule at 0xb353e8, file blah, line 1 I made a mistake in testing. Issue closed. Sorry for the noise. -- Terry Jan Reedy ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com