Project

General

Profile

Backport #5755

Errors raised and rescued in Kernel#loaded file still propagate

Added by now (Nikolai Weibull) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:41612]

Description

a.rb:

load 'b.rb'

b.rb:

begin
BasicObject.new.inspect
rescue => e
p e
end

% ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33569) [x86_64-darwin10.8.0]
% ruby a.rb
#>
b.rb:4:in to_str': undefined methodinspect' for
#BasicObject:0x0000010090b388 (NoMethodError)
from b.rb:4:in to_s'
from b.rb:4:in
inspect'
from b.rb:4:in p'
from b.rb:4:in
rescue in '
from b.rb:1:in <top (required)>'
from a.rb:1:in
load'
from a.rb:1:in <main>'
% ruby b.rb
#<NoMethodError: undefined method
inspect' for #BasicObject:0x0000010090b388>

This is a bug, right?


Files

bug_5755.patch (590 Bytes) bug_5755.patch nagachika (Tomoyuki Chikanaga), 12/13/2011 12:24 PM

Associated revisions

Revision 3dd1e6a9
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 34030
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

Revision 34030
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

Revision 34030
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

Revision 34030
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

Revision 34030
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

Revision 34030
Added by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]

Revision 79634569
Added by naruse (Yui NARUSE) over 7 years ago

merge revision(s) 34028,34030:

    * error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
      ignore exception under rb_protect().

    * test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
      add a corresponding test.
      ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 34466
Added by naruse (Yui NARUSE) over 7 years ago

merge revision(s) 34028,34030:

* error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
  ignore exception under rb_protect().

* test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
  add a corresponding test.
  ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]

History

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • File bug_5755.patch bug_5755.patch added
  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)
  • Target version set to 2.0.0

Thank you for your report.
I think this is a bug too.

I've found a bad usage of rb_protect() in name_err_mesg_to_str(). When an exception is going to ignored, rb_thread_t::errinfo should be cleared. I'll attach a patch. I'd like to commit it later if there's no objection.

BTW, I wonder if the similar problem exists in openssl extension. nahi-san, how do you think?

#2

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34030.
Nikolai, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ChangeLog: add ML/ticket links to r34028 entry. [ruby-core:41612] [Bug #5755]
#3

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Category deleted (core)
  • Status changed from Closed to Open
  • Target version deleted (2.0.0)

Please backport r34028 and r34030.

#4

Updated by naruse (Yui NARUSE) over 7 years ago

  • Status changed from Open to Closed

This issue was solved with changeset r34466.
Nikolai, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 34028,34030:

* error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
  ignore exception under rb_protect().

* test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
  add a corresponding test.
  ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]

Also available in: Atom PDF