diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-04-14 11:28:41 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-04-15 02:10:38 +0200 |
commit | a1db5ecd935ef1fc95ad8844f33f293fe22bfdf5 (patch) | |
tree | f08b34026d68d26aa027b4e174e5cff3c939cd84 /weakmap.c | |
parent | 45c6b58768c53b5021a780c7e5fec2382e940b04 (diff) | |
download | ruby-a1db5ecd935ef1fc95ad8844f33f293fe22bfdf5.tar.gz |
Add specs for ObjectSpace::WeakKeyMap
[Feature #18498]
Diffstat (limited to 'weakmap.c')
-rw-r--r-- | weakmap.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |