From 4e836fb4ea3aca143604d156c982d4f8c00fbd5b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 10 Feb 2014 19:43:41 +0200 Subject: [PATCH] mp_obj_equal(): Instead of assert(), throw NotImplementedError. With a nice traceback, helps debugging much better. --- py/obj.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/obj.c b/py/obj.c index e3e9dbfd55..4e0184a5f0 100644 --- a/py/obj.c +++ b/py/obj.c @@ -132,9 +132,9 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) { return r == mp_const_true ? true : false; } } - // TODO: Debugging helper - printf("Equality for '%s' and '%s' types not yet implemented\n", mp_obj_get_type_str(o1), mp_obj_get_type_str(o2)); - assert(0); + + nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_NotImplementedError, + "Equality for '%s' and '%s' types not yet implemented", mp_obj_get_type_str(o1), mp_obj_get_type_str(o2))); return false; } }