[issue41912] Long generator chain causes segmentation fault

Tim Peters report at bugs.python.org
Fri Oct 2 16:01:37 EDT 2020


Tim Peters <tim at python.org> added the comment:

The docs are already clear about that you play with `setrecursionlimit()` at your own risk:

"""
Set the maximum depth of the Python interpreter stack to limit. This limit prevents infinite recursion from causing an overflow of the C stack and crashing Python.

The highest possible limit is platform-dependent. A user may need to set the limit higher when they have a program that requires deep recursion and a platform that supports a higher limit. This should be done with care, because a too-high limit can lead to a crash.
"""

If you see a crash instead of a `RecursionError` exception when you _don't_ shoot yourself in the foot this way, that might be interesting. But, as is, you're deliberately overriding a mechanism designed to prevent these kinds of crashes.

----------
nosy: +tim.peters

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41912>
_______________________________________


More information about the Python-bugs-list mailing list