mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Call nlr_raise in py_assert.
* nlr_jump shouldn't be called directly because it doesn't free fb memory. * Fix #417
This commit is contained in:
parent
175a23b6ee
commit
d248f99551
@ -12,7 +12,7 @@
|
|||||||
#define PY_ASSERT_TRUE(cond) \
|
#define PY_ASSERT_TRUE(cond) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond) == 0) { \
|
if ((cond) == 0) { \
|
||||||
nlr_jump(mp_obj_new_exception_msg( \
|
nlr_raise(mp_obj_new_exception_msg( \
|
||||||
&mp_type_OSError, \
|
&mp_type_OSError, \
|
||||||
"Operation not supported")); \
|
"Operation not supported")); \
|
||||||
} \
|
} \
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#define PY_ASSERT_TRUE_MSG(cond, msg) \
|
#define PY_ASSERT_TRUE_MSG(cond, msg) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond) == 0) { \
|
if ((cond) == 0) { \
|
||||||
nlr_jump(mp_obj_new_exception_msg( \
|
nlr_raise(mp_obj_new_exception_msg( \
|
||||||
&mp_type_OSError, msg)); \
|
&mp_type_OSError, msg)); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#define PY_ASSERT_FALSE_MSG(cond, msg) \
|
#define PY_ASSERT_FALSE_MSG(cond, msg) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond) == 1) { \
|
if ((cond) == 1) { \
|
||||||
nlr_jump(mp_obj_new_exception_msg( \
|
nlr_raise(mp_obj_new_exception_msg( \
|
||||||
&mp_type_OSError, msg)); \
|
&mp_type_OSError, msg)); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
@ -39,7 +39,7 @@
|
|||||||
__typeof__ (obj) _a = (obj); \
|
__typeof__ (obj) _a = (obj); \
|
||||||
__typeof__ (type) _b = (type); \
|
__typeof__ (type) _b = (type); \
|
||||||
if (!MP_OBJ_IS_TYPE(_a, _b)) { \
|
if (!MP_OBJ_IS_TYPE(_a, _b)) { \
|
||||||
nlr_jump(mp_obj_new_exception_msg_varg( \
|
nlr_raise(mp_obj_new_exception_msg_varg( \
|
||||||
&mp_type_TypeError, \
|
&mp_type_TypeError, \
|
||||||
"Can't convert %s to %s", \
|
"Can't convert %s to %s", \
|
||||||
mp_obj_get_type_str(_a), \
|
mp_obj_get_type_str(_a), \
|
||||||
@ -51,7 +51,7 @@
|
|||||||
do { \
|
do { \
|
||||||
__typeof__ (obj) _a = (obj); \
|
__typeof__ (obj) _a = (obj); \
|
||||||
if (!MP_OBJ_IS_STR(_a)) { \
|
if (!MP_OBJ_IS_STR(_a)) { \
|
||||||
nlr_jump(mp_obj_new_exception_msg_varg( \
|
nlr_raise(mp_obj_new_exception_msg_varg( \
|
||||||
&mp_type_TypeError, \
|
&mp_type_TypeError, \
|
||||||
"Can't convert %s to %s", \
|
"Can't convert %s to %s", \
|
||||||
mp_obj_get_type_str(_a), \
|
mp_obj_get_type_str(_a), \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user