long l;
PyObject *rc = 0;
- if (mp_tolong_checked(PFILT_F(me)->m, &l)) goto end;
- rc = PyInt_FromLong(l);
-end:
+ if (!mp_tolong_checked(PFILT_F(me)->m, &l, 0)) rc = PyInt_FromLong(l);
+ else rc = mp_topylong(PFILT_F(me)->m);
return (rc);
}
mp *x = 0;
pgen_event *ev = PGEVENT_EV(me);
int rc = -1;
+ if (!x) NIERR("__del__");
PGEVENT_CHECK(me);
if ((x = getmp(xobj)) == 0) goto end;
mp_drop(ev->m);
static PyMethodDef pgev_pymethods[] = {
#define METHNAME(name) pgmeth_##name
- METH (pg_abort, "E.pg_abort() -> PGRC -- prime generation aborted")
- METH (pg_done, "E.pg_done() -> PGRC -- prime generation finished")
- METH (pg_begin, "E.pg_begin() -> PGRC -- commence stepping/testing")
- METH (pg_try, "E.pg_try() -> PGRC -- found new candidate")
- METH (pg_pass, "E.pg_pass() -> PGRC -- passed primality test")
- METH (pg_fail, "E.pg_fail() -> PGRC -- failed primality test")
+ METH (pg_abort, "E.pg_abort(EV) -> PGRC -- prime generation aborted")
+ METH (pg_done, "E.pg_done(EV) -> PGRC -- prime generation finished")
+ METH (pg_begin, "E.pg_begin(EV) -> PGRC -- commence stepping/testing")
+ METH (pg_try, "E.pg_try(EV) -> PGRC -- found new candidate")
+ METH (pg_pass, "E.pg_pass(EV) -> PGRC -- passed primality test")
+ METH (pg_fail, "E.pg_fail(EV) -> PGRC -- failed primality test")
#undef METHNAME
{ 0 }
};