From 86f6256d3af882dc92c11547fc696f71a74a7038 Mon Sep 17 00:00:00 2001 From: lericson Date: Thu, 27 May 2010 21:53:33 +0200 Subject: [PATCH] Fix backward compatibility for set_multi timeout. Fixes #13 HOH --- _pylibmcmodule.c | 8 ++++---- tests.py | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/_pylibmcmodule.c b/_pylibmcmodule.c index 34eba50..2aafa68 100644 --- a/_pylibmcmodule.c +++ b/_pylibmcmodule.c @@ -453,12 +453,12 @@ static PyObject *_PylibMC_RunSetCommandMulti(PylibMC_Client* self, PyObject * retval = NULL; size_t idx = 0; - static char *kws[] = { "keys", "key_prefix", "time", "min_compress_len", NULL }; + static char *kws[] = { "keys", "time", "key_prefix", "min_compress_len", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!II", kws, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|ISI", kws, &PyDict_Type, &keys, - &PyString_Type, &key_prefix, - &time, &min_compress)) { + &time, &key_prefix, + &min_compress)) { return NULL; } diff --git a/tests.py b/tests.py index f133739..018e5dc 100644 --- a/tests.py +++ b/tests.py @@ -74,11 +74,15 @@ True >>> c.get("hi") >>> c.set("hi", "loretta", int(time()) + 2) True +>>> c.set_multi({"hi2": "charlotta"}, 1) +[] >>> c.get("hi") 'loretta' +>>> c.get("hi2") +'charlotta' >>> sleep(3.1) ->>> c.get("hi") ->>> +>>> c.get("hi"), c.get("hi2") +(None, None) See issue #1 ``http://github.com/lericson/pylibmc/issues/#issue/1`` -- delete should not accept a time argument.