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 *k = KEY_K(me);
unsigned long et;
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);
goto end;
if (!(KEY_KF(me)->f & KF_WRITE))
KEYERR(KERR_READONLY);
key *k = KEY_K(me);
unsigned long dt;
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");
goto end;
if (dt == KEXP_FOREVER && k->exp != KEXP_FOREVER)
VALERR("key will eventually expire");