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?
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.
Yes, I can think of at least one: segmentation faults.
>>> import faulthandler
>>> faulthandler._sigsegv()
Segmentation fault
The faulthandler module is specifically designed to help in such situations.
>>> import faulthandler
>>> faulthandler.enable()
>>> faulthandler._sigsegv()
Fatal Python error: Segmentation fault
Current thread 0xb76fe6c0
File "<stdin>", line 1 in <module>
Segmentation fault
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With