Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hash#shift when at capacity #5393

merged 3 commits into from Oct 31, 2018


Copy link

@headius headius commented Oct 31, 2018

This fixes #5392.

@ChrisBr Please review this fix! I was not sure if this is the best way to proceed. Other methods that mutate the Hash usually call checkResize, which avoids the issue. Since we're shifting it should not need to grow, so I added the additional length check instead.

This spec attempts to construct a number of different size hashes
and shift one value from each, since we can't know what default
sizes a given implenentation uses as its capacity levels. The
resulting successful sizes are aggregated and used for a single
@headius headius added this to the JRuby milestone Oct 31, 2018
@headius headius merged commit 613b68d into jruby:master Oct 31, 2018
@headius headius deleted the hash-shift-at-capacity branch October 31, 2018 04:13
Copy link

ChrisBr commented Oct 31, 2018

Yeah, that makes sense! The patch LGTM, thanks for taking care @headius 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Hash#shift fails at capacity boundaries
2 participants