*.c: Use Python macros rather than functions where possible.
[catacomb-python] / mp.c
diff --git a/mp.c b/mp.c
index 31eec24..fc49eca 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -1011,10 +1011,10 @@ static PyObject *mmmeth_factor(PyObject *me, PyObject *arg)
   mp *x;
 
   if (!MPMUL_LIVEP(me)) VALERR("MPMul object invalid");
-  if (PyTuple_Size(arg) != 1)
+  if (PyTuple_GET_SIZE(arg) != 1)
     i = PyObject_GetIter(arg);
   else {
-    if ((q = PyTuple_GetItem(arg, 0)) == 0) goto end;
+    if ((q = PyTuple_GET_ITEM(arg, 0)) == 0) goto end;
     if ((i = PyObject_GetIter(q)) == 0) {
       PyErr_Clear(); /* that's ok */
       i = PyObject_GetIter(arg);
@@ -1683,7 +1683,7 @@ static PyObject *mcmeth_solve(PyObject *me, PyObject *arg)
   Py_ssize_t i = 0, n = c->k;
 
   Py_INCREF(me);
-  if (PyTuple_Size(arg) == n)
+  if (PyTuple_GET_SIZE(arg) == n)
     q = arg;
   else if (!PyArg_ParseTuple(arg, "O:solve", &q))
     goto end;
@@ -1727,7 +1727,7 @@ static PyObject *mpcrt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
   mpmul mm;
   mpcrt_pyobj *c = 0;
 
-  if (PyTuple_Size(arg) > 1)
+  if (PyTuple_GET_SIZE(arg) > 1)
     q = arg;
   else if (!PyArg_ParseTupleAndKeywords(arg, kw, "O:new", KWLIST, &q))
     goto end;
@@ -1780,7 +1780,7 @@ static PyObject *mcget_moduli(PyObject *me, void *hunoz)
 
   if ((q = PyList_New(c->k)) == 0) return (0);
   for (i = 0; i < c->k; i++)
-    PyList_SetItem(q, i, mp_pywrap(c->v[i].m));
+    PyList_SET_ITEM(q, i, mp_pywrap(c->v[i].m));
   return (q);
 }