New submission from Elazar Gershuni: There's no dedicated StackOverflowErrorException, So there is no way to accurately distinguish a recursion overflow from a general RuntimeError.
One cannot use the exception message, since the docs explicitly says that "Exception messages are not part of the Python API", and checking for len(traceback.extract_tb(trace)) >= sys.getrecursionlimit()-1 is ugly, and (AFAIK) not guaranteed to be correct. Use case: I've found this while trying to create a cycle detector that will compress the traceback of such errors. See discussion in python-ideas: https://mail.python.org/pipermail/python-ideas/2013-September/023190.html An cycle-detection implementation: http://code.activestate.com/recipes/578660-concise-output-for-maximum-recursion-depth-exceede/ ---------- components: Library (Lib) messages: 199595 nosy: elazar priority: normal severity: normal status: open title: Add a dedicated subclass for recursion errors type: enhancement versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19235> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com