delete_multi breaks if one of the key parts is empty string
Bug #832131 reported by
Pete-alex-harris
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python Memcached |
Incomplete
|
Undecided
|
Sean Reifschneider |
Bug Description
In the Client class of memcache.py, check_key() tests falsity of the key using "if not key" and if the key being checked is an empty string, it raises Client.
In the context of delete/
The correct behaviour should be to test "if key is None", and add a check for an empty key such as "if len(key) + key_extra_len == 0", once it has been established that the key is a string.
To post a comment you must log in.
The *_multi methods take "key" and "key_prefix" arguments. From a quick review of the code, it looks like f the key gets to check_key as '', then it is indeed the key and not the key_prefix, is empty. Also see _map_and_ prefix_ keys() where it checks "if not key_prefix" before calling check_key( key_prefix) .
Can you provide a proposed patch which fixes this? From looking at the code, it's not clear to me what change you are proposing.