On 01.07.2019 12:25, Jeroen Demeyer wrote:
A SystemError is typically raised from C to indicate serious bugs in the application which shouldn't normally be caught and handled. It's used for example for NULL arguments where a Python object is expected. So in some sense, SystemError is the Python equivalent of a segmentation fault.
Since these exceptions should typically not be handled in a try/except Exeption block, I suggest to make SystemError inherit directly from BaseException instead of Exception.
https://docs.python.org/3/library/exceptions.html#SystemError:
Raised when the interpreter finds an internal error, but the situation does not look so serious to cause it to abandon all hope. <...>
You should report this to the author or maintainer of your Python interpreter. For cases where the interpreter deems it too dangerous to continue, there's Py_FatalError().
And if it's safe to continue, the exception can be handled -- and since no-one specifically expecs SystemError, will be either logged, or ignored if the author explicitly doesn't mind if the particular code fails -- whether for this reason or any other. -- Regards, Ivan