Jump to solution
Verify

The Fix

pip install redis==7.1.0

Based on closed redis/redis-py issue #3358 · 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
@@ -125,7 +125,7 @@ jobs: python-version: [ '3.8', '3.13'] parser-backend: [ 'hiredis' ] - hiredis-version: [ '>=3.0.0', '<3.0.0' ] + hiredis-version: [ '>=3.2.0', '<3.0.0' ] event-loop: [ 'asyncio' ]
repro.py
>> import redis >> from redis.cache import CacheConfig >> r = redis.Redis(host='localhost', port=6379, protocol=3, cache_config=CacheConfig()) >> r.set(b'foo', b'bar') Traceback (most recent call last): File "<python-input-3>", line 1, in <module> r.set(b'foo', b'bar') ~~~~~^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/commands/core.py", line 2335, in set return self.execute_command("SET", *pieces, **options) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 559, in execute_command return self._execute_command(*args, **options) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 565, in _execute_command conn = self.connection or pool.get_connection(command_name, **options) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 1422, in get_connection connection.connect() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 773, in connect self._conn.connect() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 385, in connect callback(self) ~~~~~~~~^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 922, in _enable_tracking_callback conn._parser.set_invalidation_push_handler(self._on_invalidation_callback) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: '_HiredisParser' object has no attribute 'set_invalidation_push_handler'
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
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\nOption C — Workaround\nfor this? It still doesn't work.\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: >> import redis
  • Mechanism: Supports RESP3 with the hiredis-py parser and fixes issues related to hiredis compatibility.
  • Why the fix works: Supports RESP3 with the hiredis-py parser and fixes issues related to hiredis compatibility. (first fixed release: 7.1.0).
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

  • Shows up under Python 3.9 in real deployments (not just unit tests).
  • Surfaces as: >> import redis

Proof / Evidence

  • GitHub issue: #3358
  • Fix PR: https://github.com/redis/redis-py/pull/3648
  • 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.24

Discussion

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

“https://github.com/redis/redis-py/pull/3324 was released but its still failing”
@93578237 · 2024-12-19 · confirmation · source
“Thanks for the reply, when can we expect it to be released.”
@mahudees · 2024-08-21 · confirmation · source
“@uglide As an aside, why was the release tag format changed from v6.1.0 to v.6.2.0 (extra dot)? I foresee that breaking systems...”
@akx · 2025-05-28 · source
“No one knows. For the time being, use hiredis<3.0.”
@akx · 2024-08-27 · source

Failure Signature (Search String)

  • >> import redis

Error Message

Stack trace
error.txt
Error Message ------------- >> import redis >> from redis.cache import CacheConfig >> r = redis.Redis(host='localhost', port=6379, protocol=3, cache_config=CacheConfig()) >> r.set(b'foo', b'bar') Traceback (most recent call last): File "<python-input-3>", line 1, in <module> r.set(b'foo', b'bar') ~~~~~^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/commands/core.py", line 2335, in set return self.execute_command("SET", *pieces, **options) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 559, in execute_command return self._execute_command(*args, **options) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 565, in _execute_command conn = self.connection or pool.get_connection(command_name, **options) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 1422, in get_connection connection.connect() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 773, in connect self._conn.connect() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 385, in connect callback(self) ~~~~~~~~^^^^^^ File "/usr/local/lib/pyth ... (truncated) ...

Minimal Reproduction

repro.py
>> import redis >> from redis.cache import CacheConfig >> r = redis.Redis(host='localhost', port=6379, protocol=3, cache_config=CacheConfig()) >> r.set(b'foo', b'bar') Traceback (most recent call last): File "<python-input-3>", line 1, in <module> r.set(b'foo', b'bar') ~~~~~^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/commands/core.py", line 2335, in set return self.execute_command("SET", *pieces, **options) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 559, in execute_command return self._execute_command(*args, **options) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 565, in _execute_command conn = self.connection or pool.get_connection(command_name, **options) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 1422, in get_connection connection.connect() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 773, in connect self._conn.connect() ~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 385, in connect callback(self) ~~~~~~~~^^^^^^ File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 922, in _enable_tracking_callback conn._parser.set_invalidation_push_handler(self._on_invalidation_callback) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: '_HiredisParser' object has no attribute 'set_invalidation_push_handler'

Environment

  • Python: 3.9

What Broke

Users experienced AttributeError when using hiredis with redis-py for server-assisted caching.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install redis==7.1.0

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option C — Workaround Temporary workaround

for this? It still doesn't work.

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.

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

First fixed release: 7.1.0

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

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

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.

Version Compatibility Table

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