From 592ded79f1dfab91a059c183db4706c35a36d69a Mon Sep 17 00:00:00 2001 From: git-hulk Date: Mon, 30 Jun 2025 20:34:26 +0800 Subject: [PATCH] Convert the value to int type only if it exists in CLIENT INFO Currently, client info will try to convert the set of keys to the int type without checking if it exists or not. For example, both `argv-mem` and `tot-mem` are introduced in 6.2, and force converting an non-existent value might cause an exception in older version. To keep the compatibility with the older/newer Redis server, we could just convert it only if the key exists. --- redis/_parsers/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redis/_parsers/helpers.py b/redis/_parsers/helpers.py index 5468addf62..154dc66dfb 100644 --- a/redis/_parsers/helpers.py +++ b/redis/_parsers/helpers.py @@ -676,7 +676,8 @@ def parse_client_info(value): "omem", "tot-mem", }: - client_info[int_key] = int(client_info[int_key]) + if int_key in client_info: + client_info[int_key] = int(client_info[int_key]) return client_info