Re: Python parser problem

Discussion in 'Python' started by Terry Reedy, Dec 13, 2012.

  1. Terry Reedy

    Terry Reedy Guest

    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
    Terry Reedy, Dec 13, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernd Oninger
    Replies:
    0
    Views:
    746
    Bernd Oninger
    Jun 9, 2004
  2. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    801
    Paul King
    Oct 5, 2004
  3. Bernd Oninger
    Replies:
    0
    Views:
    802
    Bernd Oninger
    Jun 9, 2004
  4. Joel Hedlund
    Replies:
    2
    Views:
    492
    Joel Hedlund
    Nov 11, 2006
  5. Joel Hedlund
    Replies:
    0
    Views:
    294
    Joel Hedlund
    Nov 11, 2006
Loading...

Share This Page