chiark / gitweb /
*.c: Be more careful about `PySequence_Size'.
[catacomb-python] / ec.c
diff --git a/ec.c b/ec.c
index ef5d855a9c7071dfc69fd947a4a9e14da96305fe..6280010d7701421026de9589f75fc77206aa3691 100644 (file)
--- a/ec.c
+++ b/ec.c
@@ -465,7 +465,7 @@ static int ecptxl_1(ec_curve *c, ec *p, PyObject *x)
     if (!EC_FIND(c, p, xx)) VALERR("not on the curve");
   } else if (PySequence_Check(x)) {
     t = x; x = 0;
-    n = PySequence_Size(t);
+    n = PySequence_Size(t); if (n < 0) goto end;
     if (n != 2 && (n != 3 || !c))
       TYERR("want sequence of two or three items");
     if ((x = PySequence_GetItem(t, 0)) == 0 ||