Mark Shannon <[email protected]> added the comment:
If you make calls in an exception handler that is handling a RecursionError,
without unwinding first, then it is likely that another RecursionError may
occur.
What is strange is that the second RecursionError is raised after
`print(str(e))` has printed the exception, which is weird and needs further
investigation.
The following code, using `list.append` shows what happens without the
additional RecursionError from print.
`list.append` is safe to use as it never raises a RecursionError.
import sys
sys.setrecursionlimit(100)
events = []
def foo(c):
try:
c = c + 1
events.append("ss"+str(c))
foo(c)
except Exception as e:
events.append(e)
events.append("kk")
events.append(c)
c = 0
foo(c)
for ev in events:
print(ev)
ss1
ss2
....
ss97
maximum recursion depth exceeded while getting the str of an object
kk
97
95
......
3
2
1
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42950>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com