InterruptedError
In Python, InterruptedError is a built-in exception that occurs when a system call is interrupted by an external signal.
This exception corresponds to the C errno value EINTR. Since Python 3.5 and PEP 475, the interpreter automatically retries system calls that are interrupted by a signal instead of raising InterruptedError, so you’ll rarely see it in normal operation. It can still surface if a signal handler raises an exception, or when calling lower-level functions that haven’t adopted the automatic-retry behavior.
InterruptedError Occurs When
- Performing system calls in multithreaded programs
InterruptedError Can Be Used When
- Managing signals in asynchronous operations
- Implementing robust error handling in applications that rely on system calls
Related Resources
Tutorial
An Intro to Threading in Python
In this intermediate-level tutorial, you'll learn how to use threading in your Python programs. You'll see how to create threads, how to coordinate and synchronize them, and how to handle common problems that arise in threading.
For additional information on related topics, take a look at the following resources:
- Getting Started With Async Features in Python (Tutorial)
- Python's asyncio: A Hands-On Walkthrough (Tutorial)
- Raising and Handling Python Exceptions (Course)
- Threading in Python (Course)
- Python Threading (Quiz)
- Getting Started With Async Features in Python (Quiz)
- Hands-On Python 3 Concurrency With the asyncio Module (Course)
- Python's asyncio: A Hands-On Walkthrough (Quiz)
By Leodanis Pozo Ramos • Updated June 7, 2026