Actions
Bug #11615
closedForwardable fails to adjust backtrace when Exception is defined in the target class
Description
Forwardable fails to adjust backtrace when Exception is defined in the target class as follows:
$ cat t.rb
require "forwardable"
class Foo
extend Forwardable
def_delegator :bar, :baz
class Exception
end
end
Foo.new.baz
$ ruby t.rb
/home/shugo/local/lib/ruby/2.3.0/forwardable.rb:183:in `baz': undefined local variable or method `bar' for #<Foo:0x007fe48a6e65b0> (NameError)
Did you mean? baz
from t.rb:12:in `<main>'
Without the definition of Foo::Exception, backtrace is shown as follows:
$ ruby t.rb
t.rb:12:in `<main>': undefined local variable or method `bar' for #<Foo:0x007f455d9d1c38> (NameError)
Did you mean? baz
Updated by shugo (Shugo Maeda) over 8 years ago
- Status changed from Open to Closed
Applied in changeset r52249.
- lib/forwardable (def_instance_delegator, def_single_delegator):
rescue ::Exception instead of Exception in case Exception is
defined under the target class.
[ruby-core:71175] [Ruby trunk - Bug #11615]
Actions
Like0
Like0