Passing \r to PyRun_SimpleString syntax error?

Carl Bray cbray at orchestream.com
Fri Dec 22 08:07:50 EST 2000


I'm wondering if this is a bug??

We've embedded python into our application, we're then passing in a string
converted from a file. This file can be created on either Windows or UNIX.

We have found that passing in a \r 0x0D char causes the parser to return a
syntax error. This seems inconsistent with the Lexical analysis in the
reference manaul ...

2.1 Line structure
A Python program is divided into a number of logical lines.
2.1.1 Logical lines
The end of a logical line is represented by the token NEWLINE. Statements
cannot cross logical line boundaries
except where NEWLINE is allowed by the syntax (e.g., between statements in
compound statements). A logical line
is constructed from one or more physical lines by following the explicit or
implicit line joining rules.
2.1.2 Physical lines
A physical line ends in whatever the current platform's convention is for
terminating lines. On UNIX, this is the
ASCII LF (linefeed) character. On DOS/Windows, it is the ASCII sequence CR
LF (return followed by linefeed). On
Macintosh, it is the ASCII CR (return) character.





More information about the Python-list mailing list