key.c: Use tuple functions on `KeyError' argument tuple.
[catacomb-python] / field.c
diff --git a/field.c b/field.c
index d35f1b8..224363d 100644 (file)
--- a/field.c
+++ b/field.c
@@ -126,16 +126,6 @@ static mp *tofe(field *f, PyObject *o)
   return (y);
 }
 
-mp *getfe(field *f, PyObject *o)
-{
-  mp *x = 0;
-  if ((x = tofe(f, o)) == 0) {
-    PyErr_Format(PyExc_TypeError, "can't convert %.100s to fe",
-                o->ob_type->tp_name);
-  }
-  return (x);
-}
-
 /*----- Field elements ----------------------------------------------------*/
 
 static int febinop(PyObject *x, PyObject *y,
@@ -274,7 +264,7 @@ static PyObject *fe_pylong(PyObject *x)
 #define BASEOP(name, radix, pre)                                       \
   static PyObject *fe_py##name(PyObject *x) {                          \
     mp *xx = F_OUT(FE_F(x), MP_NEW, FE_X(x));                          \
-    PyObject *rc = mp_topystring(FE_X(x), radix, 0, pre, 0);           \
+    PyObject *rc = mp_topystring(xx, radix, 0, pre, 0);                        \
     MP_DROP(xx);                                                       \
     return (rc);                                                       \
   }
@@ -801,8 +791,11 @@ end:
   return (0);
 }
 
+static PyObject *bfget_p(PyObject *me, void *hunoz)
+  { return (gf_pywrap(MP_COPY(FIELD_F(me)->m))); }
+
 static PyGetSetDef binpolyfield_pygetset[] = {
-#define GETSETNAME(op, name) pf##op##_##name
+#define GETSETNAME(op, name) bf##op##_##name
   GET  (p,             "F.p -> field polynomial")
 #undef GETSETNAME
   { 0 }
@@ -881,7 +874,7 @@ static PyObject *bnfget_beta(PyObject *me, void *hunoz)
 }
 
 static PyGetSetDef binnormfield_pygetset[] = {
-#define GETSETNAME(op, name) pf##op##_##name
+#define GETSETNAME(op, name) bf##op##_##name
   GET  (p,             "F.p -> field polynomial")
 #undef GETSETNAME
 #define GETSETNAME(op, name) bnf##op##_##name