Skip to content

Hash does not detect or reject rehash during iteration #9268

@headius

Description

@headius

We do not currently detect or reject Hash#rehash during iteration. There may be other modification-during-iteration cases that we do not detect but should.

This leads to two failures in CRuby tests:

TestHash#test_update_modify_in_block [/home/runner/work/jruby/jruby/test/mri/ruby/test_hash.rb:1303]:
Exception(RuntimeError) with message matches to /rehash during iteration/.
RuntimeError expected but nothing was raised.

TestHash::TestSubHash#test_update_modify_in_block [/home/runner/work/jruby/jruby/test/mri/ruby/test_hash.rb:1303]:
Exception(RuntimeError) with message matches to /rehash during iteration/.
RuntimeError expected but nothing was raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions