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 set_backtrace signature when passing nil value #738

Merged
merged 1 commit into from
Aug 13, 2021

Conversation

HoneyryderChuck
Copy link
Contributor

irb(main):001:0> e = StandardError.new
=> #<StandardError: StandardError>
irb(main):002:0> e.set_backtrace nil
=> nil
irb(main):003:0> e.set_backtrace "bang"
=> ["bang"]

without this change, there are steep errors everywhere where the following idiommatic ruby expression is used:

def raise_another(error)
  ex =  StandardError.new
  ex.set_backtrace(error.backtrace)
  raise ex
end

because error.backtrace can be nil.

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@soutaro soutaro merged commit 6950d49 into ruby:master Aug 13, 2021
@HoneyryderChuck HoneyryderChuck deleted the fix-set-backtrace branch August 13, 2021 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants