Skip to content

Commit dd0a0f7

Browse files
committed
py/viper: Truncate viper integer args so they can be up to 32-bit.
1 parent daa1a45 commit dd0a0f7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

py/nativeglue.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) {
4848
switch (type & 3) {
4949
case MP_NATIVE_TYPE_OBJ: return (mp_uint_t)obj;
5050
case MP_NATIVE_TYPE_BOOL:
51-
case MP_NATIVE_TYPE_INT: return mp_obj_get_int(obj);
51+
case MP_NATIVE_TYPE_INT: return mp_obj_get_int_truncated(obj);
5252
case MP_NATIVE_TYPE_UINT: {
5353
mp_buffer_info_t bufinfo;
5454
if (mp_get_buffer(obj, &bufinfo, MP_BUFFER_RW)) {
5555
return (mp_uint_t)bufinfo.buf;
5656
} else {
57-
// TODO should be mp_obj_get_uint_truncated or something
58-
return mp_obj_get_int(obj);
57+
return mp_obj_get_int_truncated(obj);
5958
}
6059
}
6160
default: assert(0); return 0;

0 commit comments

Comments
 (0)