summaryrefslogtreecommitdiff
path: root/py/obj.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-05 23:13:52 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-05 23:13:52 +0000
commitbe6d8be91e133e98117025062df0e63aaf87efd2 (patch)
tree692495154f547612c148312b4abc0afc3f4a50d6 /py/obj.c
parent451a0870753be89f5a284fd39727705a3ad2109b (diff)
py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.
mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/obj.c b/py/obj.c
index e58149588..c869a6546 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -179,7 +179,7 @@ mp_int_t mp_obj_hash(mp_obj_t o_in) {
if (hash_method[0] != MP_OBJ_NULL) {
mp_obj_t hash_val = mp_call_method_n_kw(0, 0, hash_method);
if (MP_OBJ_IS_INT(hash_val)) {
- return mp_obj_int_get(hash_val);
+ return mp_obj_int_get_truncated(hash_val);
}
}
}