This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Trundle
Recipients Trundle, marienz
Date 2011-02-26.22:39:50
SpamBayes Score 3.878542e-09
Marked as misclassified No
Message-id <1298759991.59.0.16834388397.issue11343@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, if the parser's internal stack is full (as it happens when
the parser tries to parse a deeply nested structure), the parser
writes an error message to stderr and a bare MemoryError is
raised. That way, it is really hard for REPLs do handle input that
causes the parser to exhaust its stack correctly (see e.g. ``python -c
"print '(' * 100 + ')' * 100" | python -c "import code;
code.interact()"``).

In my opinion, a SyntaxError would be great because that way one can
easily see where in the source code the error is caused. One reason
against that (stated by MvL in msg1687) is that it's really
syntactically correct Python and only the parser can't parse it. But
then, the same is also true when there are too many indentation levels
in which case an `IndentationError` is raised (which is a subclass of
`SyntaxError`).

I have attached two patches: The first still raises a `MemoryError`
(for the sake of backward compatibility) but adds a message ("too many
opening parens") to it. The second raises a `SyntaxError` instead.
History
Date User Action Args
2011-02-26 22:39:52Trundlesetrecipients: + Trundle, marienz
2011-02-26 22:39:51Trundlesetmessageid: <1298759991.59.0.16834388397.issue11343@psf.upfronthosting.co.za>
2011-02-26 22:39:50Trundlelinkissue11343 messages
2011-02-26 22:39:50Trundlecreate