chiark / gitweb /
algorithms.c: Support the new 16-bit key-size descriptors.
[catacomb-python] / ec.c
diff --git a/ec.c b/ec.c
index 9d4d6e75faeb742858d9e75b63b1a661178f79fb..63d97d8c26438db8e8d7e106823f7c769e745bc2 100644 (file)
--- a/ec.c
+++ b/ec.c
@@ -525,8 +525,8 @@ static PyObject *ecpt_pyint(PyObject *me)
   PyObject *rc = 0;
   if (EC_ATINF(ECPT_P(me))) VALERR("point at infinity");
   getecptout(&p, me);
-  if (mp_tolong_checked(p.x, &l)) goto end;
-  rc = PyInt_FromLong(l);
+  if (!mp_tolong_checked(p.x, &l, 0)) rc = PyInt_FromLong(l);
+  else rc = mp_topylong(p.x);
 end:
   EC_DESTROY(&p);
   return (rc);