Skip to content

Commit e99841b

Browse files
committed
mp_obj_get_int(): Add warning against adding implicit float->int conversion.
1 parent 09a4d83 commit e99841b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

py/obj.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) {
181181
}
182182

183183
machine_int_t mp_obj_get_int(mp_obj_t arg) {
184+
// This function essentially performs implicit type conversion to int
185+
// Note that Python does NOT provide implicit type conversion from
186+
// float to int in the core expression language, try some_list[1.0].
184187
if (arg == mp_const_false) {
185188
return 0;
186189
} else if (arg == mp_const_true) {

0 commit comments

Comments
 (0)