New submission from Andreas Stührk <andy-pyt...@hammerhartes.de>: 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. ---------- components: Interpreter Core files: parser_nested_MemoryError.patch keywords: patch messages: 129604 nosy: Trundle, marienz priority: normal severity: normal status: open title: Make errors due to full parser stack identifiable type: feature request versions: Python 3.3 Added file: http://bugs.python.org/file20925/parser_nested_MemoryError.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11343> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com