chiark / gitweb /
debian/: Use `dh_python2' for packaging.
[catacomb-python] / util.c
diff --git a/util.c b/util.c
index 58d2fe7ebd7525998e4211983541b3ed5125fa6d..7118bfb7b59f64d3408bc4a533a2c7170600f1ff 100644 (file)
--- a/util.c
+++ b/util.c
@@ -83,6 +83,7 @@ int convulong(PyObject *o, void *pp)
   unsigned long *p = pp;
   PyObject *t;
 
+  if (!o) VALERR("can't delete");
   if (PyInt_Check(o)) {
     i = PyInt_AS_LONG(o);
     if (i < 0) VALERR("must be nonnegative");
@@ -132,6 +133,7 @@ int convk64(PyObject *o, void *pp)
   int rc = 0;
   uint32 lo, hi;
 
+  if (!o) VALERR("can't delete");
   if (init_i32()) goto end;
   if ((i = PyNumber_Int(o)) == 0) goto end;
   lo = PyInt_AsUnsignedLongMask(i);
@@ -176,8 +178,11 @@ end:
 
 int convbool(PyObject *o, void *pp)
 {
+  if (!o) VALERR("can't delete");
   *(int *)pp = PyObject_IsTrue(o);
   return (1);
+end:
+  return (0);
 }
 
 /*----- Type messing ------------------------------------------------------*/