Message129604
| 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:52 | Trundle | set | recipients:
+ Trundle, marienz |
| 2011年02月26日 22:39:51 | Trundle | set | messageid: <1298759991.59.0.16834388397.issue11343@psf.upfronthosting.co.za> |
| 2011年02月26日 22:39:50 | Trundle | link | issue11343 messages |
| 2011年02月26日 22:39:50 | Trundle | create |
|