summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/obj.c b/py/obj.c
index 2b5585be42..555a4a8b96 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -231,6 +231,14 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) {
}
}
+mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg) {
+ if (MP_OBJ_IS_INT(arg)) {
+ return mp_obj_int_get_truncated(arg);
+ } else {
+ return mp_obj_get_int(arg);
+ }
+}
+
// returns false if arg is not of integral type
// returns true and sets *value if it is of integral type
// can throw OverflowError if arg is of integral type, but doesn't fit in a mp_int_t