The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #3332 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
-[flake8]
-max-line-length = 88
-exclude =
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not apply this fix if both definitions are intended for different contexts.\n\n
Why This Fix Works in Production
- Trigger: This leads to potential confusion and errors when the class is referenced in the code.
- Mechanism: Deletes the first-defined (and thus duplicate) `Script` class in `redis/commands/core.py`, resolving the issue of class redefinition.
- Why the fix works: Deletes the first-defined (and thus duplicate) `Script` class in `redis/commands/core.py`, resolving the issue of class redefinition. (first fixed release: 7.1.0).
- If left unfixed, retries/timeouts can trigger duplicate external side-effects (double charges, duplicate emails, repeated writes).
Why This Breaks in Prod
- Production symptom (often without a traceback): This leads to potential confusion and errors when the class is referenced in the code.
Proof / Evidence
- GitHub issue: #3332
- Fix PR: https://github.com/redis/redis-py/pull/3147
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.84
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“This would be caught by a linter such as Ruff: https://github.com/redis/redis-py/pull/3147 https://docs.astral.sh/ruff/rules/redefined-while-unused/”
“> But then you would be using ruff. This is true. Is that a problem?”
“I apologize, my comment just created disharmony and didn't contribute anything useful. Please disregard.”
Failure Signature (Search String)
- This leads to potential confusion and errors when the class is referenced in the code.
Copy-friendly signature
Failure Signature
-----------------
This leads to potential confusion and errors when the class is referenced in the code.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
This leads to potential confusion and errors when the class is referenced in the code.
What Broke
This leads to potential confusion and errors when the class is referenced in the code.
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/3147
First fixed release: 7.1.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if both definitions are intended for different contexts.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
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.