You can see the whole call stack from inspect.stack()
, so currently taken depth would be len(inspect.stack(0))
.
On the other hand, I guess you got the complete stack printed out when "maximum recursion depth exceeded" exception was raised. That stack trace should show you exactly what went wrong.