Stop accepting time argument for delete. Fixes #1
parent
5c059a0ccd
commit
f88c8c3afe
|
@ -520,15 +520,13 @@ static PyObject *PylibMC_Client_delete(PylibMC_Client *self, PyObject *args) {
|
|||
PyObject *retval;
|
||||
char *key;
|
||||
Py_ssize_t key_sz;
|
||||
unsigned int time;
|
||||
memcached_return rc;
|
||||
|
||||
retval = NULL;
|
||||
time = 0;
|
||||
if (PyArg_ParseTuple(args, "s#|I", &key, &key_sz, &time)
|
||||
if (PyArg_ParseTuple(args, "s#:delete", &key, &key_sz)
|
||||
&& _PylibMC_CheckKeyStringAndSize(key, key_sz)) {
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
rc = memcached_delete(self->mc, key, key_sz, time);
|
||||
rc = memcached_delete(self->mc, key, key_sz, 0);
|
||||
Py_END_ALLOW_THREADS;
|
||||
switch (rc) {
|
||||
case MEMCACHED_SUCCESS:
|
||||
|
@ -893,10 +891,10 @@ static PyObject *PylibMC_Client_delete_multi(PylibMC_Client *self,
|
|||
PyObject *call_args;
|
||||
PyObject *retval;
|
||||
|
||||
static char *kws[] = { "keys", "time", "key_prefix", NULL };
|
||||
static char *kws[] = { "keys", "key_prefix", NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O!S", kws,
|
||||
&keys, &PyInt_Type, &time, &prefix))
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|S:delete_multi", kws,
|
||||
&keys, &prefix))
|
||||
return NULL;
|
||||
|
||||
/**
|
||||
|
|
11
tests.py
11
tests.py
|
@ -80,6 +80,17 @@ True
|
|||
>>> c.get("hi")
|
||||
>>>
|
||||
|
||||
See issue #1 ``http://github.com/lericson/pylibmc/issues/#issue/1`` -- delete
|
||||
should not accept a time argument.
|
||||
>>> c.delete("foo", 123)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
TypeError: delete() takes exactly 1 argument (2 given)
|
||||
>>> c.delete_multi(["foo"], time=123)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
TypeError: 'time' is an invalid keyword argument for this function
|
||||
|
||||
Now for keys with funny types.
|
||||
>>> c.set(1, "hi")
|
||||
Traceback (most recent call last):
|
||||
|
|
Reference in New Issue