mp.c: Accept `0x', `0o' and `0b' prefixes on strings with explicit base.
[catacomb-python] / group.c
diff --git a/group.c b/group.c
index 8774290..1e93ccc 100644 (file)
--- a/group.c
+++ b/group.c
@@ -589,7 +589,10 @@ static PyObject *ge_pyexp(PyObject *x, PyObject *n, PyObject *m)
   mp *nn;
   ge *z;
 
-  if (m != Py_None || !GE_PYCHECK(x) || (nn = implicitmp(n)) == 0)
+  if (m != Py_None || !GE_PYCHECK(x)) RETURN_NOTIMPL;
+  if (FE_PYCHECK(n) && FE_F(n)->ops->ty == FTY_PRIME)
+    nn = F_OUT(FE_F(n), MP_NEW, FE_X(n));
+  else if ((nn = implicitmp(n)) == 0)
     RETURN_NOTIMPL;
   z = G_CREATE(GE_G(x));
   G_EXP(GE_G(x), z, GE_X(x), nn);