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
merged 3 commits into from Oct 31, 2018

Conversation

Projects
None yet
2 participants
@headius
Copy link
Member

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.

headius added some commits Oct 31, 2018

Add spec for Hash#shift at capacity. See #5392.
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
expectation.

@headius headius added this to the JRuby 9.2.1.0 milestone Oct 31, 2018

@headius headius merged commit 613b68d into jruby:master Oct 31, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@headius headius deleted the headius:hash-shift-at-capacity branch Oct 31, 2018

@ChrisBr

This comment has been minimized.

Copy link
Contributor

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
You can’t perform that action at this time.