X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/0e29d9164d5cc4e3cafa509cda19de2e025446c1..be6df1c38491ef517f2f55f2abc9c9e64ea034b0:/pgen.c?ds=sidebyside diff --git a/pgen.c b/pgen.c index 15d1f6a..30b78ed 100644 --- a/pgen.c +++ b/pgen.c @@ -120,9 +120,8 @@ static PyObject *pfilt_pyint(PyObject *me) 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); } @@ -425,6 +424,7 @@ static int peset_x(PyObject *me, PyObject *xobj, void *hunoz) 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); @@ -1035,8 +1035,8 @@ pgen(START, [name = 'p', stepper = PrimeGenStepper(2),\n\ strongprime_setup(NBITS, [name = 'p', event = pgen_nullev,\n\ rng = rand, nsteps = 0]) -> (START, JUMP)") KWMETH(strongprime, "\ -strongprime_setup(NBITS, [name = 'p', event = pgen_nullev,\n\ - rng = rand, nsteps = 0]) -> P") +strongprime(NBITS, [name = 'p', event = pgen_nullev,\n\ + rng = rand, nsteps = 0]) -> P") KWMETH(limlee, "\ limlee(PBITS, QBITS, [name = 'p', event = pgen_nullev,\n\ ievent = pgen_nullev, rng = rand, nsteps = 0]) -> (P, [Q, ...])")