X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/8dd6ebb3267ad16ed43eeea1d625be4937eaade1..637b91402d2497db1318debd3cb3868a5abb8f01:/catacomb.c diff --git a/catacomb.c b/catacomb.c index 0f1b233..01311bf 100644 --- a/catacomb.c +++ b/catacomb.c @@ -129,6 +129,19 @@ end: return (z); } +int convmpw(PyObject *o, void *pp) +{ + unsigned long u; + unsigned *p = pp; + + if (!convulong(o, &u)) goto end; + if (u > MPW_MAX) VALERR("out of range"); + *p = u; + return (1); +end: + return (0); +} + static PyObject *smallprimes(void) { PyObject *v = PyList_New(NPRIME); @@ -151,14 +164,14 @@ static PyObject *meth__ego(PyObject *me, PyObject *arg) static PyMethodDef methods[] = { #define METHNAME(func) meth_##func - METH (_ego, "_ego(ARGV0)") + METH (_ego, "_ego(ARGV0)") #undef METHNAME { 0 } }; static void init_random(void) { -#if PY_MAJOR_VERSION >= 3 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) +#if PY_VERSION_HEX >= 0x02060000 char *seed; uint32 r; @@ -174,6 +187,8 @@ static void init_random(void) EXPORT void init_base(void) { PyObject *mod; + + modname = PyString_FromString("catacomb"); addmethods(methods); INIT_MODULES; init_random();