Windows Python 2.4: Unbuffered flag causes SyntaxError oninteractive sessions?
Steve Holden
steve at holdenweb.com
Thu Sep 15 05:14:51 EDT 2005
Lonnie Princehouse wrote:
> After doing some more reading, I now think this isn't a bug.
>
> Evidently the unbuffered flag not only makes stdin unbuffered, but it
> also forces it into binary mode. I didn't realize that when I posted
> earlier.
>
> So the SyntaxErrors arise because the interpreter isn't converting \r\n
> into \n because stdin is binary. Not a bug, although it would be nice
> to have an "unbuffered text mode" flag too...
>
> D'oh.
>
It seems a little bizarre to me that the compiler isn't prepared to
treat carriage returns as whitespace during its tokenizations. The only
area I would anticipate problems would be string literals containing
end-of-line sequences embedded within triple-quotes.
It would seem to make sense to program the compiler defensively to
ignore embedded "\r" characters.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list