The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #3020 · 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%.
@@ -16,6 +16,7 @@ exclude =
E126
E203
+ E231
E701
E704
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n
Why This Fix Works in Production
- Trigger: Retire wrap_socket from ssl and tests
- Mechanism: Updates the trove and CI to support the Python 3.12 release announcement, addressing the deprecation of wrap_socket in Python 3.12.
- Why the fix works: Updates the trove and CI to support the Python 3.12 release announcement, addressing the deprecation of wrap_socket in Python 3.12. (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
- Shows up under Python 3.12 in real deployments (not just unit tests).
- Production symptom (often without a traceback): Retire wrap_socket from ssl and tests
Proof / Evidence
- GitHub issue: #3020
- Fix PR: https://github.com/redis/redis-py/pull/2979
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.81
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Python 3.12 formally removes wrap_socket due to CWE-295. Prior to rolling in 3.12, while deprecating 3.7 we need to solve this issue. This change requires a release of redis-py 5.1.0, and dropping Python 3.7. #2979”
Failure Signature (Search String)
- Retire wrap_socket from ssl and tests
- This change requires a release of redis-py 5.1.0, and dropping Python 3.7.
Copy-friendly signature
Failure Signature
-----------------
Retire wrap_socket from ssl and tests
This change requires a release of redis-py 5.1.0, and dropping Python 3.7.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Retire wrap_socket from ssl and tests
This change requires a release of redis-py 5.1.0, and dropping Python 3.7.
Environment
- Python: 3.12
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/2979
First fixed release: 7.1.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
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.