python-mraa.i: ValueError when expecting bytearray but dont get it
authorBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 25 Feb 2015 19:23:25 +0000 (19:23 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Wed, 25 Feb 2015 19:23:25 +0000 (19:23 +0000)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/python/python-mraa.i

index 56ee3eb..8d68020 100644 (file)
@@ -13,6 +13,9 @@
     // whilst this may seem 'hopeful' it turns out this is safe
     $1 = (uint8_t*) PyByteArray_AsString($input);
     $2 = PyByteArray_Size($input);
+  } else {
+    PyErr_SetString(PyExc_ValueError, "bytearray expected");
+    return NULL;
   }
 }
 
@@ -22,6 +25,9 @@
     // whilst this may seem 'hopeful' it turns out this is safe
     $1 = (uint8_t*) PyByteArray_AsString($input);
     $2 = PyByteArray_Size($input);
+  } else {
+    PyErr_SetString(PyExc_ValueError, "bytearray expected");
+    return NULL;
   }
 }