Repository navigation
Conversation
CRuby's sig_signame returns nil when signo2signm has no name for the number, but JRuby raised an ArgumentError. Return nil instead and remove the tag for the spec that now passes. Fixes jruby#10094
CRuby converts the argument with NUM2INT, which raises RangeError when the number doesn't fit in an int. JRuby already does the same, but no spec covered it.
kares
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signal.signame raised an ArgumentError for a number with no signal name, like
Signal.signame(99). CRuby returns nil there, becausesig_signamereturns nil whensigno2signmfinds no name:https://github.com/ruby/ruby/blob/06b18f11f4b0078e2683c661e7762fff7c04636c/signal.c#L310-L315
This makes JRuby return nil too.
Signal.signame(0)still returns "EXIT".trapalready treats a nil from signame as an invalid number, sotrap(99) {}still raises ArgumentError as before.There was already a spec for this in spec/ruby/core/signal/signame_spec.rb, so I removed its failing tag. I also added a spec that an out-of-range number raises RangeError, like CRuby's NUM2INT does. JRuby already did that, but nothing tested it. I ran spec/ruby/core/signal on JRuby, and the signame spec with the JIT and on CRuby too. They all pass.
One thing I noticed but didn't change: signame_tags.txt has a stale duplicate tag with the old spelling "precendence".
Fixes #10094