Closed
Description
In Python Memcached 1.56 (w/ six-1.9.0 & Python 2.7.10)
doing
cache.set('foo', False)
cache.get('foo')
generates a ValueError: invalid literal for int() with base 10: 'False'
line 1235 memcache.py
When the method _val_to_store_info is called the path code that it is followed with a boolean is
elif isinstance(val, int):
flags |= Client._FLAG_INTEGER
val = str(val)
if six.PY3:
val = val.encode('ascii')
# force no attempt to compress this silly string.
min_compress_len = 0
Since the flags bits have been set to an integer, the boolean value is changed to a string ('False'). So in the method _recv_value the code tries to change that string to an int which fails .
In Python Memcached 1.54
the original code in _val_to_store_info is
elif isinstance(val, int):
flags |= Client._FLAG_INTEGER
val = "%d" % val
# force no attempt to compress this silly string.
min_compress_len = 0
the issue also affect when checking for long values
Metadata
Metadata
Assignees
Labels
No labels