diff options
author | Damien George <damien.p.george@gmail.com> | 2019-05-03 23:18:30 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-05-03 23:18:30 +1000 |
commit | 5ea38e4d7485aca5ce4e74bff1785c0d8e41fa1c (patch) | |
tree | 068a6d455b9461e2839806ae860cbca7895c3153 /py/nativeglue.c | |
parent | 9a6f6fd68d2563e0115b11c01c322aaa14a107bb (diff) | |
download | micropython-5ea38e4d7485aca5ce4e74bff1785c0d8e41fa1c.tar.gz micropython-5ea38e4d7485aca5ce4e74bff1785c0d8e41fa1c.zip |
py/native: Improve support for bool type in viper functions.
Variables with type bool now act more like an int, and there is proper
casting to/from Python objects.
Diffstat (limited to 'py/nativeglue.c')
-rw-r--r-- | py/nativeglue.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/nativeglue.c b/py/nativeglue.c index db54d12332..c810f31e60 100644 --- a/py/nativeglue.c +++ b/py/nativeglue.c @@ -60,7 +60,7 @@ mp_uint_t mp_native_from_obj(mp_obj_t obj, mp_uint_t type) { DEBUG_printf("mp_native_from_obj(%p, " UINT_FMT ")\n", obj, type); switch (type & 0xf) { case MP_NATIVE_TYPE_OBJ: return (mp_uint_t)obj; - case MP_NATIVE_TYPE_BOOL: + case MP_NATIVE_TYPE_BOOL: return mp_obj_is_true(obj); case MP_NATIVE_TYPE_INT: case MP_NATIVE_TYPE_UINT: return mp_obj_get_int_truncated(obj); default: { // cast obj to a pointer |