From 78abfb87e63a227f454530b2fa38e4f12fb54b9b Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 31 Jul 2015 14:11:26 +0200 Subject: [PATCH] Add PY_ASSERT_TRUE_MSG --- src/omv/py/py_assert.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/omv/py/py_assert.h b/src/omv/py/py_assert.h index f73d747a4..38dc8eeb4 100644 --- a/src/omv/py/py_assert.h +++ b/src/omv/py/py_assert.h @@ -17,6 +17,14 @@ } \ } while(0) +#define PY_ASSERT_TRUE_MSG(cond, msg) \ + do { \ + if ((cond) ==0){ \ + nlr_jump(mp_obj_new_exception_msg( \ + &mp_type_OSError, msg)); \ + } \ + } while(0) + #define PY_ASSERT_TYPE(obj, type) \ do { \ __typeof__ (obj) _a = (obj); \