py: Make bytes type hashable.

This commit is contained in:
Paul Sokolovsky
2014-04-13 05:41:00 +03:00
parent 73b7027b83
commit f130ca1f60
2 changed files with 3 additions and 2 deletions

View File

@@ -1480,7 +1480,8 @@ STATIC void bad_implicit_conversion(mp_obj_t self_in) {
}
uint mp_obj_str_get_hash(mp_obj_t self_in) {
if (MP_OBJ_IS_STR(self_in)) {
// TODO: This has too big overhead for hash accessor
if (MP_OBJ_IS_STR(self_in) || MP_OBJ_IS_TYPE(self_in, &mp_type_bytes)) {
GET_STR_HASH(self_in, h);
return h;
} else {