diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-12 03:48:48 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-12 03:48:48 +0000 |
commit | a72581d70f8b6d04b584d4f1ab8e115c8a5269bc (patch) | |
tree | d0c0804a644e33a8f43c4dab3861090ab3c33f13 /test | |
parent | fe96e87e725fe70e9c05db009326b8be02afd254 (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_exception.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 43115de3bd..8dafa45120 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -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 |