InterruptedError
In Python, InterruptedError is a built-in exception that occurs when a system call is interrupted by an incoming signal.
This exception corresponds to the C errno value EINTR. Since Python 3.5 and PEP 475, the standard library’s system call wrappers automatically retry calls that a signal interrupts instead of raising InterruptedError, so you’ll rarely see it in normal operation. It can still surface when you call lower-level code that hasn’t adopted the automatic-retry behavior, such as third-party C extensions or ctypes calls into system libraries. When a signal handler raises an exception, Python doesn’t retry the call and propagates that exception instead of InterruptedError.
InterruptedError Occurs When
- A blocking system call is interrupted by a signal and the call isn’t covered by PEP 475’s automatic retry, for example in a third-party C extension or a
ctypescall into a system library
InterruptedError Can Be Used When
- Managing signals in asynchronous operations
- Implementing robust error handling in applications that rely on system calls
Related Resources
Tutorial
Python's Built-in Exceptions: A Walkthrough With Examples
In this tutorial, you'll get to know some of the most commonly used built-in exceptions in Python. You'll learn when these exceptions can appear in your code and how to handle them. Finally, you'll learn how to raise some of these exceptions in your code.
For additional information on related topics, take a look at the following resources:
- An Intro to Threading in Python (Tutorial)
- Getting Started With Async Features in Python (Tutorial)
- Python's asyncio: A Hands-On Walkthrough (Tutorial)
- Raising and Handling Python Exceptions (Course)
- Working With Python's Built-in Exceptions (Course)
- Python's Built-in Exceptions: A Walkthrough With Examples (Quiz)
- 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 Aug. 13, 2026