diff options
author | Yusuke Endoh <[email protected]> | 2023-11-08 17:34:09 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2023-11-21 15:15:23 +0900 |
commit | 1cf2fa3af50203f261341ff4c250735c9da5767b (patch) | |
tree | c41d009efe0fd60e44e55a9190487c6ee5aba9de /hash.c | |
parent | a787e0d6494443cfd9bd05ac746704079dcfd03f (diff) |
Raise an exception when Hash#compare_by_identity during its iteration
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -4367,6 +4367,9 @@ rb_hash_compare_by_id(VALUE hash) if (rb_hash_compare_by_id_p(hash)) return hash; rb_hash_modify_check(hash); + if (hash_iterating_p(hash)) { + rb_raise(rb_eRuntimeError, "compare_by_identity during iteration"); + } ar_force_convert_table(hash, __FILE__, __LINE__); HASH_ASSERT(RHASH_ST_TABLE_P(hash)); |