Search code examples
pythonruntime-errortraceback

Are there runtime errors(= exceptions) that do not generate a traceback in python?


Are there runtime errors(= exceptions) that do not generate a traceback? If yes, why do some runtime errors not generate tracebacks? could you give some examples?


Solution

  • You can pass a very large value to sys.setrecursionlimit(), then enter an infinite recursive loop. The interpreter will crash without a traceback in that case.

    However, that's only because the call to setrecursionlimit() effectively disables the fail-safe mechanism that would have turned a potential stack overflow into a Python exception.