summaryrefslogtreecommitdiff
path: root/weakmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'weakmap.c')
-rw-r--r--weakmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/weakmap.c b/weakmap.c
index 8629d77ffb..f5b9a5fbf4 100644
--- a/weakmap.c
+++ b/weakmap.c
@@ -727,8 +727,9 @@ wkmap_aset(VALUE self, VALUE key, VALUE value)
struct weakkeymap *w;
TypedData_Get_Struct(self, struct weakkeymap, &weakkeymap_type, w);
- if (!(FL_ABLE(key) && !SYMBOL_P(key) && !RB_BIGNUM_TYPE_P(key))) {
+ if (!FL_ABLE(key) || SYMBOL_P(key) || RB_BIGNUM_TYPE_P(key) || RB_TYPE_P(key, T_FLOAT)) {
rb_raise(rb_eArgError, "WeakKeyMap must be garbage collectable");
+ UNREACHABLE_RETURN(Qnil);
}
st_index_t hash = wkmap_lookup_hash(w, key);