Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Python parser problem

Reply
Thread Tools

Re: Python parser problem

 
 
Terry Reedy
Guest
Posts: n/a
 
      12-13-2012
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 "iCam_GIT5_5.py", 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
import parser does not import parser.py in same dir on win Joel Hedlund Python 2 11-11-2006 03:46 PM
import parser does not import parser.py in same dir on win Joel Hedlund Python 0 11-11-2006 11:34 AM
XML Parser VS HTML Parser ZOCOR Java 11 10-05-2004 01:58 PM
XMLparser: Difference between parser.setErrorHandler() vs. parser.setContentHandler() Bernd Oninger Java 0 06-09-2004 01:26 AM
XMLparser: Difference between parser.setErrorHandler() vs. parser.setContentHandler() Bernd Oninger XML 0 06-09-2004 01:26 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57