From a2220e36362246cd0c0748924f3731600f73d488 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Wed, 25 Feb 2015 19:23:25 +0000 Subject: [PATCH] python-mraa.i: ValueError when expecting bytearray but dont get it Signed-off-by: Brendan Le Foll --- src/python/python-mraa.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/python/python-mraa.i b/src/python/python-mraa.i index 56ee3eb..8d68020 100644 --- a/src/python/python-mraa.i +++ b/src/python/python-mraa.i @@ -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; } }