*.c: Use Python `METH_NOARGS' methods where applicable.
[catacomb-python] / field.c
diff --git a/field.c b/field.c
index 51864d0..987b47d 100644 (file)
--- a/field.c
+++ b/field.c
@@ -280,10 +280,9 @@ static void fe_pydealloc(PyObject *me)
 }
 
 #define UNOP(name, check)                                              \
-  static PyObject *femeth_##name(PyObject *me, PyObject *arg) {                \
+  static PyObject *femeth_##name(PyObject *me) {                       \
     field *f = FE_F(me);                                               \
     mp *x = FE_X(me);                                                  \
-    if (!PyArg_ParseTuple(arg, ":" #name)) return (0);                 \
     if (!f->ops->name) TYERR(#name " not supported for this field");   \
     check                                                              \
     x = f->ops->name(f, MP_NEW, x);                                    \
@@ -335,14 +334,14 @@ static const PyGetSetDef fe_pygetset[] = {
 
 static const PyMethodDef fe_pymethods[] = {
 #define METHNAME(func) femeth_##func
-  METH (inv,           "X.inv() -> X^{-1}")
-  METH (sqr,           "X.sqr() -> X^2")
-  METH (sqrt,          "X.sqrt() -> sqrt(X)")
-  METH (quadsolve,     "X.quadsolve() -> Y where Y^2 + Y = X (binary only)")
-  METH (dbl,           "X.dbl() -> 2 * X (prime only)")
-  METH (tpl,           "X.tpl() -> 3 * X (prime only)")
-  METH (qdl,           "X.qdl() -> 4 * X (prime only)")
-  METH (hlv,           "X.hlv() -> X/2 (prime only)")
+  NAMETH(inv,          "X.inv() -> X^{-1}")
+  NAMETH(sqr,          "X.sqr() -> X^2")
+  NAMETH(sqrt,         "X.sqrt() -> sqrt(X)")
+  NAMETH(quadsolve,    "X.quadsolve() -> Y where Y^2 + Y = X (binary only)")
+  NAMETH(dbl,          "X.dbl() -> 2 * X (prime only)")
+  NAMETH(tpl,          "X.tpl() -> 3 * X (prime only)")
+  NAMETH(qdl,          "X.qdl() -> 4 * X (prime only)")
+  NAMETH(hlv,          "X.hlv() -> X/2 (prime only)")
 #undef METHNAME
   { 0 }
 };