chiark / gitweb /
debian/: Use `dh_python2' for packaging.
[catacomb-python] / pgen.c
diff --git a/pgen.c b/pgen.c
index 15d1f6a0ebb33acca387f730c8d6ea3049bc255e..8b5f6b23e10d2212ab6273a28bbf4c43acb925a7 100644 (file)
--- 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);
 }
 
@@ -220,7 +219,7 @@ static PyTypeObject pfilt_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Small-primes filter.",
+"PrimeFilter(X): small-primes filter.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -353,7 +352,7 @@ static PyTypeObject rabin_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Rabin-Miller strong primality test.",
+"RabinMiller(X): Rabin-Miller strong primality test.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -726,7 +725,7 @@ static PyTypeObject pgstep_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-  "Simple prime-number stepper with small-factors filter.",
+"PrimeGenStepper(STEP): simple stepper with small-factors filter.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -808,7 +807,7 @@ static PyTypeObject pgjump_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Stepper for larger steps, with small-factors filter.",
+"PrimeGenJumper(JUMP): stepper for larger steps with small-factors filter.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -869,7 +868,7 @@ static PyTypeObject pgtest_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Rabin-Miller tester.",
+"PrimeGenTester(): Rabin-Miller tester.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -1035,8 +1034,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, ...])")