Repository navigation
Conversation
Member
Contributor
Author
|
Thanks for looking. I opened #10113 because the merge alone won't fix master: there As for how I found it: not with an LLM. I'm doing differential testing of JRuby against CRuby, and I report a mismatch once I've checked it against CRuby's source and the documented behavior. If reports like this aren't useful to you, or you'd prefer fewer of them, just let me know. |
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.
Fixes #10106 on master.
exit,exit!andProcess.exitcast their argument toRubyObjectinHelpers.exitbefore converting it, so aBasicObjectstatus that is not anObject, such as aSimpleDelegator, raised a JavaClassCastException. The argument is now kept as anIRubyObject; the rest of the method already handled one. As with CRuby'sexit_status_code(true,falseorNUM2INT(status), process.c#L4341),exit(SimpleDelegator.new(3))now exits with status 3, and a delegator of something that is not an Integer raisesTypeError.SystemExit#initializetook the first argument as the status only when it was a Fixnum or a boolean, and otherwise as the message. Likeexit_initialize, which callsrb_check_to_int(status)(error.c#L2244), it is now the status when it is an Integer orto_intreturns one, and the message otherwise. SoSystemExit.new(obj)withobj.to_intreturning 3 has status 3 and message"SystemExit".rb_check_to_intreturns nil whento_intreturns something else, so this callsto_intwithout the type check ofConvert.checkToInteger, which would raiseTypeErrorthere. With the same change,SystemExit.new(3.7)has status 3 andSystemExit.new(2**70)keeps the Bignum as its status, as in CRuby 4.0.9 and 3.4.12; before, both were taken as the message with status 0.This adds "converts an argument that is not an Object with #to_int" to the shared
process_exitandprocess_exit!specs inspec/ruby/shared/process/exit.rb(run forKernel#exit,Kernel.exit,Process.exitand theexit!variants), and "accepts a status that converts with #to_int" and "uses the argument as the message if #to_int does not return an Integer" tospec/ruby/core/exception/system_exit_spec.rb. The new examples fail before this change and pass after it, with the default parser and with-Xparser.prism, and pass on CRuby 4.0.9 and 3.4.12. Tested withspec/ruby/core/exception,spec/ruby/core/kernel/exit_spec.rbandspec/ruby/core/process/exit_spec.rb(default parser and-Xparser.prism) andtest/mri/ruby/test_exception.rb. No new failures.This is the master version of #10112, where
exitis inHelpers.exit. The new example inshared/process/exit.rbusesshould.raiselike the rest of that file on master.