Skip to content

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 ctypes call 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
Python's Built-In Exceptions: A Walkthrough With Examples

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.

intermediate python

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Aug. 13, 2026