The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #845 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -1,6 +1,12 @@
@@ -1,6 +1,12 @@
"""Internal module for Python 2 backwards compatibility."""
+import errno
import sys
# For Python older than 3.5, retry EINTR.
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and
sys.version_info[1] < 5):
# Adapted from https://bugs.python.org/review/23863/patch/14532/54418
import socket
import time
import errno
from select import select as _select
def select(rlist, wlist, xlist, timeout):
while True:
try:
return _select(rlist, wlist, xlist, timeout)
except InterruptedError:
continue
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not apply this fix if targeting only Python 3 environments.\n\n
Why This Fix Works in Production
- Trigger: redis._compat: global name 'InterruptedError' is not defined
- Mechanism: The code uses 'InterruptedError', which is not defined in Python 2
- Why the fix works: Defined `InterruptedError` as `OSError` if not defined like in Python 2, fixing compatibility issues. (first fixed release: 7.1.0).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- The code uses 'InterruptedError', which is not defined in Python 2
- Surfaces as: redis._compat: global name 'InterruptedError' is not defined
Proof / Evidence
- GitHub issue: #845
- Fix PR: https://github.com/redis/redis-py/pull/846
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.57
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@gjcarneiro See #846 and help review this change.”
Failure Signature (Search String)
- redis._compat: global name 'InterruptedError' is not defined
Error Message
Stack trace
Error Message
-------------
redis._compat: global name 'InterruptedError' is not defined
Minimal Reproduction
# For Python older than 3.5, retry EINTR.
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and
sys.version_info[1] < 5):
# Adapted from https://bugs.python.org/review/23863/patch/14532/54418
import socket
import time
import errno
from select import select as _select
def select(rlist, wlist, xlist, timeout):
while True:
try:
return _select(rlist, wlist, xlist, timeout)
except InterruptedError:
continue
What Broke
The application fails to handle interrupted system calls in Python 2, causing unexpected behavior.
Why It Broke
The code uses 'InterruptedError', which is not defined in Python 2
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install redis==7.1.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/redis/redis-py/pull/846
First fixed release: 7.1.0
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if targeting only Python 3 environments.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
- Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.
Version Compatibility Table
| Version | Status |
|---|---|
| 7.1.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.