summaryrefslogtreecommitdiffstatshomepage
path: root/py/modbuiltins.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/modbuiltins.c')
-rw-r--r--py/modbuiltins.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 1e91d43211..76274c2393 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -272,8 +272,8 @@ STATIC mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_divmod_obj, mp_builtin_divmod);
STATIC mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
- // TODO hash will generally overflow small integer; can we safely truncate it?
- return mp_obj_new_int(mp_obj_hash(o_in));
+ // result is guaranteed to be a (small) int
+ return mp_unary_op(MP_UNARY_OP_HASH, o_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hash_obj, mp_builtin_hash);