From 9fb94c12c0fa53ab4081446c3991c1ca4733e7e8 Mon Sep 17 00:00:00 2001 From: lericson Date: Fri, 18 Sep 2009 11:23:25 +0200 Subject: [PATCH] Properly cast types in get_behaviors. --- _pylibmcmodule.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_pylibmcmodule.c b/_pylibmcmodule.c index 27cd3bd..78054a3 100644 --- a/_pylibmcmodule.c +++ b/_pylibmcmodule.c @@ -663,10 +663,12 @@ static PyObject *PylibMC_Client_get_behaviors(PylibMC_Client *self) { PylibMC_Behavior *b; for (b = PylibMC_behaviors; b->name != NULL; b++) { - uint64_t bval = memcached_behavior_get(self->mc, b->flag); - PyObject *x = PyInt_FromLong(bval); + uint64_t bval; + PyObject *x; - if (x == NULL || PyDict_SetItemString(retval, b->name, x)) { + bval = memcached_behavior_get(self->mc, b->flag); + x = PyInt_FromLong((long)bval); + if (x == NULL || PyDict_SetItemString(retval, b->name, x) == -1) { goto error; }