X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/blobdiff_plain/5f959e502e3ceea40fb3c44593e090417fa11fc9..a1be89adf16edc24a5aa8819c742308fd7632141:/mp.c diff --git a/mp.c b/mp.c index 4b73223..0c0dd86 100644 --- a/mp.c +++ b/mp.c @@ -535,8 +535,8 @@ end: #define BITOP(pre, name, c) \ static PyObject *pre##meth_##name(PyObject *me, PyObject *arg) \ { \ - int i; \ - if (!PyArg_ParseTuple(arg, "i:" #name, &i)) return (0); \ + unsigned long i; \ + if (!PyArg_ParseTuple(arg, "O&:" #name, convulong, &i)) return (0); \ return (pre##_pywrap(mp_##name##c(MP_NEW, MP_X(me), i))); \ } BITOP(mp, setbit, 2c); @@ -547,15 +547,15 @@ BITOP(gf, clearbit, ); static PyObject *mpmeth_testbit(PyObject *me, PyObject *arg) { - int i; - if (!PyArg_ParseTuple(arg, "i:testbit", &i)) return (0); + unsigned long i; + if (!PyArg_ParseTuple(arg, "O&:testbit", convulong, &i)) return (0); return (getbool(mp_testbit2c(MP_X(me), i))); } static PyObject *gfmeth_testbit(PyObject *me, PyObject *arg) { - int i; - if (!PyArg_ParseTuple(arg, "i:testbit", &i)) return (0); + unsigned long i; + if (!PyArg_ParseTuple(arg, "O&:testbit", convulong, &i)) return (0); return (getbool(mp_testbit(MP_X(me), i))); }