Actions
Bug #20455
openrb_errinfo() inconsistent with $! in the caller Ruby code
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-04-25T08:12:47Z master 64bd8e41df) [x86_64-linux]
Description
This (slightly modified for clarity) test in ruby/spec demonstrates the unexpected result:
describe "rb_errinfo" do
def err
$!
end
it "is cleared when entering a C method" do
begin
raise StandardError
rescue
$!.class.should == StandardError
err.class.should == StandardError
@s.rb_errinfo().should == nil
end
end
Why does rb_errinfo()
return nil there, when $! is set in the caller (and $! isn't per frame but per thread, as shown with err
)?
Is this bug?
If not, what is the logic and reason for clearing $!
when calling a method defined in C?
Actions
Like0
Like0