Skip to content
Snippets Groups Projects
Commit 8c50f93a authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py/runtime.h: Define mp_check_self(pred) helper macro.

Indended to replace raw asserts in bunch of files. Expands to empty
if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG is defined, otehrwise by
default still to assert, though a particular port may define it to
something else.
parent 9e1b61de
No related branches found
No related tags found
No related merge requests found
......@@ -141,6 +141,16 @@ NORETURN void mp_raise_TypeError(const char *msg);
NORETURN void mp_not_implemented(const char *msg);
NORETURN void mp_exc_recursion_depth(void);
#if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
#undef mp_check_self
#define mp_check_self(pred)
#else
// A port may define to raise TypeError for example
#ifndef mp_check_self
#define mp_check_self(pred) assert(pred)
#endif
#endif
// helper functions for native/viper code
mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type);
mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment