From 61e45e9b848e9116203243251c44514050f02790 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 21 Mar 2006 01:20:29 +0000 Subject: [PATCH] key: Use convulong instead of PyLong_AsUnsignedLong. Python 2.4's implementation of PyLong_AsUnsignedLong handles integers correctly; but 2.3 insists on having a real `long' object. Our `convulong' function handles these, and also stranger things like MPs. Use it. --- key.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/key.c b/key.c index 57d01f9..c0b9eb4 100644 --- a/key.c +++ b/key.c @@ -1482,7 +1482,7 @@ static int kset_exptime(PyObject *me, PyObject *x, void *hunoz) key *k = KEY_K(me); unsigned long et; - if ((et = PyLong_AsUnsignedLong(x)) == (unsigned long)-1 && PyErr_Occurred()) + if (!convulong(x, &et)) goto end; if (!(KEY_KF(me)->f & KF_WRITE)) KEYERR(KERR_READONLY); @@ -1498,7 +1498,7 @@ static int kset_deltime(PyObject *me, PyObject *x, void *hunoz) key *k = KEY_K(me); unsigned long dt; - if ((dt = PyLong_AsUnsignedLong(x)) == (unsigned long)-1 && PyErr_Occurred()) + if (!convulong(x, &dt)) goto end; if (dt == KEXP_FOREVER && k->exp != KEXP_FOREVER) VALERR("key will eventually expire"); -- 2.11.0