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, 4 insertions, 4 deletions
diff --git a/py/obj.c b/py/obj.c
index 7666855e5c..bdafc72476 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -110,7 +110,7 @@ machine_int_t mp_obj_hash(mp_obj_t o_in) {
return 1; // needs to hash to same as the integer 1, since True==1
} else if (MP_OBJ_IS_SMALL_INT(o_in)) {
return MP_OBJ_SMALL_INT_VALUE(o_in);
- } else if (MP_OBJ_IS_STR(o_in)) {
+ } else if (MP_OBJ_IS_STR(o_in) || MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) {
return mp_obj_str_get_hash(o_in);
} else if (MP_OBJ_IS_TYPE(o_in, &mp_type_NoneType)) {
return (machine_int_t)o_in;
@@ -333,11 +333,11 @@ mp_obj_t mp_identity(mp_obj_t self) {
MP_DEFINE_CONST_FUN_OBJ_1(mp_identity_obj, mp_identity);
bool mp_get_buffer(mp_obj_t obj, buffer_info_t *bufinfo) {
- mp_obj_base_t *o = (mp_obj_base_t *)obj;
- if (o->type->buffer_p.get_buffer == NULL) {
+ mp_obj_type_t *type = mp_obj_get_type(obj);
+ if (type->buffer_p.get_buffer == NULL) {
return false;
}
- o->type->buffer_p.get_buffer(o, bufinfo, BUFFER_READ);
+ type->buffer_p.get_buffer(obj, bufinfo, BUFFER_READ);
if (bufinfo->buf == NULL) {
return false;
}