ec.c: Accept field elements in the fast path from `samep' fields.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 Nov 2019 21:45:37 +0000 (21:45 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 11 Apr 2020 11:49:31 +0000 (12:49 +0100)
... as well as from the same field object.

ec.c

diff --git a/ec.c b/ec.c
index 9535240..444af3b 100644 (file)
--- a/ec.c
+++ b/ec.c
@@ -467,7 +467,7 @@ static PyObject *epget__z(PyObject *me, void *hunoz)
 static mp *coord_in(field *f, PyObject *x)
 {
   mp *xx;
-  if (FE_PYCHECK(x) && FE_F(x) == f)
+  if (FE_PYCHECK(x) && (FE_F(x) == f || field_samep(FE_F(x), f)))
     return (MP_COPY(FE_X(x)));
   else if ((xx = getmp(x)) == 0)
     return (0);