Jump to solution
Verify

The Fix

Adds the `score_cast_func` argument to the `zrevrank` function for consistency with the `zrevrange` function, addressing the inconsistency reported in issue #3300.

Based on closed redis/redis-py issue #3300 · 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%.

Jump to Verify Open PR/Commit
@@ -94,7 +94,7 @@ jobs: python-compatibility-tests: runs-on: ubuntu-latest - needs: [ redis_version, tests ] + needs: [ redis_version ] timeout-minutes: 60
repro.py
def zrevrange( self, name: KeyT, start: int, end: int, withscores: bool = False, score_cast_func: Union[type, Callable] = float, ) -> ResponseT:
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Apply the official fix\nAdds the `score_cast_func` argument to the `zrevrank` function for consistency with the `zrevrange` function, addressing the inconsistency reported in issue #3300.\nWhen NOT to use: This fix should not be applied if backward compatibility with existing code is a concern.\n\n

Why This Fix Works in Production

  • Trigger: Why does the `zrevrange` function offer the flexibility of `score_cast_func` while `zrevrank` does not? Given the similar nature of these functions, shouldn’t…
  • Mechanism: The zrevrank function lacked a score_cast_func parameter, causing inconsistency with zrevrange
Production impact:
  • 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 zrevrank function lacked a score_cast_func parameter, causing inconsistency with zrevrange
  • Production symptom (often without a traceback): Why does the `zrevrange` function offer the flexibility of `score_cast_func` while `zrevrank` does not? Given the similar nature of these functions, shouldn’t they both support the same score casting logic for consistency?

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“This issue has been automatically marked as stale due to inactivity. It will be closed in 30 days if no further activity occurs. If you…”
@github-actions · 2025-09-30 · source

Failure Signature (Search String)

  • Why does the `zrevrange` function offer the flexibility of `score_cast_func` while `zrevrank` does not? Given the similar nature of these functions, shouldn’t they both support
Copy-friendly signature
signature.txt
Failure Signature ----------------- Why does the `zrevrange` function offer the flexibility of `score_cast_func` while `zrevrank` does not? Given the similar nature of these functions, shouldn’t they both support the same score casting logic for consistency?

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Why does the `zrevrange` function offer the flexibility of `score_cast_func` while `zrevrank` does not? Given the similar nature of these functions, shouldn’t they both support the same score casting logic for consistency?

Minimal Reproduction

repro.py
def zrevrange( self, name: KeyT, start: int, end: int, withscores: bool = False, score_cast_func: Union[type, Callable] = float, ) -> ResponseT:

What Broke

Inconsistent score casting led to incorrect data handling in production code.

Why It Broke

The zrevrank function lacked a score_cast_func parameter, causing inconsistency with zrevrange

Fix Options (Details)

Option A — Apply the official fix

Adds the `score_cast_func` argument to the `zrevrank` function for consistency with the `zrevrange` function, addressing the inconsistency reported in issue #3300.

When NOT to use: This fix should not be applied if backward compatibility with existing code is a concern.

Fix reference: https://github.com/redis/redis-py/pull/3795

Last verified: 2026-02-12. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be applied if backward compatibility with existing code is a concern.

Verify Fix

verify
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

  • 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.

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.