diff options
| author | Paul Sokolovsky | 2014-06-07 23:22:41 +0300 |
|---|---|---|
| committer | Paul Sokolovsky | 2014-06-07 23:26:27 +0300 |
| commit | 7e4a2b0edca2953ae3dd19f9ad554739a9174c81 (patch) | |
| tree | c5a0a0faa0000789edc76dc411ca2914b80d8877 /py/runtime.c | |
| parent | aabd83ea204325cdf45355a5bdc6838745484060 (diff) | |
py: Add generic mp_not_implemented() func to use instead of assert().
Benefits: won't crash baremetal targets, will provide Python source location
when not implemented feature used (it will no longer provide C source
location, but just grep for error message).
Diffstat (limited to 'py/runtime.c')
| -rw-r--r-- | py/runtime.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c index cdbf99d4a..179b48d32 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1150,6 +1150,10 @@ void *m_malloc_fail(int num_bytes) { nlr_raise((mp_obj_t)&mp_const_MemoryError_obj); } +NORETURN void mp_not_implemented(const char *msg) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError, msg)); +} + // these must correspond to the respective enum void *const mp_fun_table[MP_F_NUMBER_OF] = { mp_load_const_int, |
