[New-bugs-announce] [issue19235] Add a dedicated subclass for recursion errors

Elazar Gershuni report at bugs.python.org
Sat Oct 12 18:41:47 CEST 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue19235>
_______________________________________


More information about the New-bugs-announce mailing list