summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-12 03:48:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-12 03:48:48 +0000
commita72581d70f8b6d04b584d4f1ab8e115c8a5269bc (patch)
treed0c0804a644e33a8f43c4dab3861090ab3c33f13 /vm_eval.c
parentfe96e87e725fe70e9c05db009326b8be02afd254 (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 'vm_eval.c')
-rw-r--r--vm_eval.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 2fb339c..e87f9fd 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -643,26 +643,18 @@ MJIT_FUNC_EXPORTED VALUE
rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
int argc, const VALUE *argv, int priv)
{
- int n = 0;
- enum {
- arg_mesg,
- arg_name,
- arg_args,
- arg_priv,
- args_size
- };
- VALUE args[args_size];
+ VALUE name = argv[0];
if (!format) {
format = rb_fstring_cstr("undefined method `%s' for %s%s%s");
}
- args[n++] = rb_name_err_mesg_new(format, obj, argv[0]);
- args[n++] = argv[0];
if (exc == rb_eNoMethodError) {
- args[n++] = rb_ary_new4(argc - 1, argv + 1);
- args[n++] = priv ? Qtrue : Qfalse;
+ VALUE args = rb_ary_new4(argc - 1, argv + 1);
+ return rb_nomethod_err_new(format, obj, name, args, priv);
+ }
+ else {
+ return rb_name_err_new(format, obj, name);
}
- return rb_class_new_instance(n, args, exc);
}
#endif /* #ifndef MJIT_HEADER */