[issue43674] strange effect at recursion limit

TW report at bugs.python.org
Wed Mar 31 08:45:00 EDT 2021


TW <tw at waldmann-edv.de> added the comment:

Eryk, thanks much for your detailled and clear explaining!

Can confirm that using os.write makes it raise the RecursionError where I expected it to be. Also print() raising the RecursionError explains the behaviour I have seen.

Sadly, this also shows that handling RecursionError is not as easy as one would wish it to be, because the usual place for the exception handler is still too close to it triggering (again) and every other usually harmless call could also trigger it on that level.

So maybe a better solution is voluntarily stopping recursion at a safe distance from the recursion limit (== not going deeper, avoiding the exception).

Or doing some tricky construction of first going upwards to a safe distance from the limit when handling this exception.

----------

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


More information about the Python-bugs-list mailing list