Refactor Kernel#raise and fix remaining specs#9407
Merged
Conversation
This is the first step in simplifying Kernel#raise logic by splitting the various arities and ensuring each works on its own. Sharing a single method, as in CRuby, is difficult to maintain and obscures the intricate behaviors between those paths. Having each arity separate will make it easier to get to 100% compliance and maintain going forward.
This is zero-sum, no new behavior.
This is zero-sum, no new behavior.
This is zero-sum, no new behavior.
Whenever core logic prepares to throw an exception, it should propagate the current error info as that exception's cause. This fixes the NameError case but others should be audited. It may make sense to route all core exception raises through a single piece of code to perform this operation in one place.
* Introduce Cause record and common extraction logic. * Factor out common parts of exception construction and cause setting. * Clean up remaining variable-arity paths from kwargs handling. * Document all utility methods.
4 tasks
LocalJumpErrors during END blocks become warnings so any remaining END blocks can execute. Clear $! so they don't become the cause of exceptions raised during other END blocks.
Fixes mri/ruby/test_exception test_warning_warn See ruby/ruby@d249b04
We do not dynamically dispatch to get the backtrace and probably never will.
Fixes one spec and CRuby test_exception's test_marshal_circular_cause.
Unsure where else this is used. There's very few references in tests, including the one this fixes.
Member
Author
|
Merged! This does not do the additional work to improve pass rate and coverage of I also audited the CRuby test_exception failures, fixed several, and added good descriptions for the remaining ones. |
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.
In response to #9398 I finally did a major refactor of Kernel#raise. This PR splits up the different arity paths rather than running them all together and moves most of the logic to common utility methods. The last two rubyspecs related to cause have also been fixed.