From ffbe879549c8a212ba70e25ee9a0367187753669 Mon Sep 17 00:00:00 2001 From: Sergey Prokazov Date: Mon, 6 Feb 2023 05:46:45 -0600 Subject: Use hiredis::pack_command to serialized the commands. (#2570) * Implemented pack command and pack bytes * 1) refactored the command packer construction process 2) now hiredis.pack_bytes is the default choice. Though it's still possible to run redisrs-py (fix the flag in utils.py) or hiredis.pack_command (flag in connection.py) * Switch to hiredis.pack_command * Remove the rust extension module. * 1) Introduce HIREDIS_PACK_AVAILABLE environment variable. 2) Extract serialization functionality out of Connection class. * 1) Fix typo. 2) Add change log entry. 3) Revert the benchmark changes * Ditch the hiredis version check for pack_command. * Fix linter errors * Revert version changes * Fix linter issues * Looks like the current redis-py version is 4.4.1 --------- Co-authored-by: Sergey Prokazov --- redis/utils.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'redis/utils.py') diff --git a/redis/utils.py b/redis/utils.py index 693d4e6..d95e62c 100644 --- a/redis/utils.py +++ b/redis/utils.py @@ -7,8 +7,10 @@ try: # Only support Hiredis >= 1.0: HIREDIS_AVAILABLE = not hiredis.__version__.startswith("0.") + HIREDIS_PACK_AVAILABLE = hasattr(hiredis, "pack_command") except ImportError: HIREDIS_AVAILABLE = False + HIREDIS_PACK_AVAILABLE = False try: import cryptography # noqa -- cgit v1.2.1