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 KeyError behavior with no arguments #6861

Merged
merged 1 commit into from Sep 28, 2021

Conversation

GabrielNagy
Copy link
Contributor

@GabrielNagy GabrielNagy commented Sep 27, 2021

After JRuby 9.3, attempting to raise a KeyError with no arguments would
fail with an ArgumentError. This commit fixes this behavior to match
MRI, and updates the key and receiver methods to raise if they are
unset.

Prior to this, the relevant MRI tests for this functionality were not
running in CI, and when ran manually 3 tests were failing. Add the
test_key_error.rb file to the mri.code suite. After this change, all
tests from test_key_error.rb pass.

Fixes #6860.

Relevant MRI code: https://github.com/ruby/ruby/blob/09863a4cd8eb40b34b310083d8cdda899ab5bcc1/error.c#L2096-L2121

After JRuby 9.3, attempting to raise a KeyError with no arguments would
fail with an ArgumentError. This commit fixes this behavior to match
MRI, and updates the `key` and `receiver` methods to raise if they are
unset.

Prior to this, the relevant MRI tests for this functionality were not
running in CI, and when ran manually 3 tests were failing. Add the
`test_key_error.rb` file to the `mri.code` suite. After this change, all
tests from `test_key_error.rb` pass.

Fixes jruby#6860.
@enebo enebo added this to the JRuby 9.3.1.0 milestone Sep 27, 2021
@enebo enebo merged commit 084bb40 into jruby:master Sep 28, 2021
@enebo
Copy link
Member

enebo commented Sep 28, 2021

Thanks @GabrielNagy

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

Successfully merging this pull request may close these issues.

Cannot raise KeyError without arguments after 9.3.0.0
2 participants