Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Re: Python parser problem (

Terry Reedy 12-13-2012 12:14 AM

Re: Python parser problem
On 12/12/2012 2:10 PM, RCU wrote:
> I would like to report a parser bug manifesting on Python 2.5, 2.7
> (but not on 2.2) and 3.3.

You are not the first to erroneously attribute a problem to Python
itself. But seriously, the interpreter itself is so thoroughly tested on
a daily basis that you should assume that a reported SyntaxError is real.

> Please see the attached script.
> Basically this bug appeared after applying PythonTidy on a valid
> script.

PythonTidy is much more likely to be buggy than Python itself.

> More exactly, when running:
> python -c "import iCam_GIT5_5"
> I get:
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "", line 60
> ^
> SyntaxError: invalid syntax

SyntaxErrors are sometimes reported on the line after they occur,
especially when the error is at the very end of the line and not obvious
until /n is read.

> The "\" used in the script to break the line in 2 is a reminiscence
> of running PythonTidy-1.22.python (so fixing this bug would be directly
> relevant when using PythonTidy).

A '\' used to break a line MUST be the last character in the line. Dave
explained how your editor and PythonTidy together made a bug.

> With this occasion I would like to ask also what are the limits of
> the Python 2.x and 3.x parser. Where can I find what are the limits on
> the size/lines of the parsed script?

Python, the language has no limits. Implementations will, but they are
larger than you will every write by hand. Auto-generated code that, for
instance, nests a tuple more than 2**16 levels deep may have problems.

Terry Jan Reedy

All times are GMT. The time now is 05:08 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.