Stop accepting time argument for delete. Fixes #1
This commit is contained in:
parent
5c059a0ccd
commit
f88c8c3afe
@ -520,15 +520,13 @@ static PyObject *PylibMC_Client_delete(PylibMC_Client *self, PyObject *args) {
|
|||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
char *key;
|
char *key;
|
||||||
Py_ssize_t key_sz;
|
Py_ssize_t key_sz;
|
||||||
unsigned int time;
|
|
||||||
memcached_return rc;
|
memcached_return rc;
|
||||||
|
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
time = 0;
|
if (PyArg_ParseTuple(args, "s#:delete", &key, &key_sz)
|
||||||
if (PyArg_ParseTuple(args, "s#|I", &key, &key_sz, &time)
|
|
||||||
&& _PylibMC_CheckKeyStringAndSize(key, key_sz)) {
|
&& _PylibMC_CheckKeyStringAndSize(key, key_sz)) {
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
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;
|
Py_END_ALLOW_THREADS;
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case MEMCACHED_SUCCESS:
|
case MEMCACHED_SUCCESS:
|
||||||
@ -893,10 +891,10 @@ static PyObject *PylibMC_Client_delete_multi(PylibMC_Client *self,
|
|||||||
PyObject *call_args;
|
PyObject *call_args;
|
||||||
PyObject *retval;
|
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,
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|S:delete_multi", kws,
|
||||||
&keys, &PyInt_Type, &time, &prefix))
|
&keys, &prefix))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
11
tests.py
11
tests.py
@ -80,6 +80,17 @@ True
|
|||||||
>>> c.get("hi")
|
>>> 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.
|
Now for keys with funny types.
|
||||||
>>> c.set(1, "hi")
|
>>> c.set(1, "hi")
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
|
Reference in New Issue
Block a user