Skip to content

Commit ce56d1c

Browse files
authored
Convert the value to int type only if it exists in CLIENT INFO (#3688)
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 or newer versions. To keep the compatibility with the older/newer Redis server, we could just convert it only if the key exists.
1 parent 310813a commit ce56d1c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

redis/_parsers/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,8 @@ def parse_client_info(value):
676676
"omem",
677677
"tot-mem",
678678
}:
679-
client_info[int_key] = int(client_info[int_key])
679+
if int_key in client_info:
680+
client_info[int_key] = int(client_info[int_key])
680681
return client_info
681682

682683

0 commit comments

Comments
 (0)