summaryrefslogtreecommitdiff
path: root/weakmap.c
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-04-14 11:28:41 +0200
committerJean Boussier <jean.boussier@gmail.com>2023-04-15 02:10:38 +0200
commita1db5ecd935ef1fc95ad8844f33f293fe22bfdf5 (patch)
treef08b34026d68d26aa027b4e174e5cff3c939cd84 /weakmap.c
parent45c6b58768c53b5021a780c7e5fec2382e940b04 (diff)
downloadruby-a1db5ecd935ef1fc95ad8844f33f293fe22bfdf5.tar.gz
Add specs for ObjectSpace::WeakKeyMap
[Feature #18498]
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);