mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
error.c: super in method_missing
* error.c (nometh_err_initialize): do not shirtcut rb_call_super, to push proper control frame. [ruby-dev:50522] [Bug #14670] * error.c (rb_nomethod_err_new): allocate and initialize a new NoMethodError instance. * vm_eval.c (rb_make_no_method_exception): create a new exception instance directly without method calls, to prevent influence of ruby level method definitions, which can cause an unpredictable behavior, e.g., infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fe96e87e72
commit
a72581d70f
4 changed files with 80 additions and 66 deletions
|
@ -1320,4 +1320,20 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
end;
|
||||
assert_in_out_err([], code, [], /Bug14566/, success: false, timeout: 1)
|
||||
end
|
||||
|
||||
def test_super_in_method_missing
|
||||
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
|
||||
begin;
|
||||
class Object
|
||||
def method_missing(name, *args, &block)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
bug14670 = '[ruby-dev:50522] [Bug #14670]'
|
||||
assert_raise_with_message(NoMethodError, /`foo'/, bug14670) do
|
||||
Object.new.foo
|
||||
end
|
||||
end;
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue