Built-in Exceptions
InterruptedError — exception class
A system call was interrupted by a signal. Since Python 3.5 many interrupted calls are retried automatically unless the signal handler raises an exception. Do not assume every signal produces this exception. The example uses the symbolic errno.EINTR to demonstrate CPython exception selection without accessing an external system. The example raises a controlled stand-in to demonstrate handling; it does not cause the real system failure. Catch InterruptedError when this category is the recovery boundary; do not rely on the exact human-readable message.
Formal Syntax & Structure
python syntaxpython
InterruptedErrorReturn Value
type
The class object InterruptedError; this reference documents the class identity, not a universal constructor signature.
Working Example
Example Snippetpython
import errnotry: raise OSError(errno.EINTR,"demo")except InterruptedError as error: print(type(error).__name__)