diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-23 15:15:03 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-23 15:15:03 +0900 |
| commit | 6999e45742329cd274b8d13231aaff39c578119b (patch) | |
| tree | cd072daa5c4ea06a8a668dec8e03924da4e80eb5 /src | |
| parent | ca0f32a208052e485f02c803ce5ea249b0f7e554 (diff) | |
| download | mruby-6999e45742329cd274b8d13231aaff39c578119b.tar.gz mruby-6999e45742329cd274b8d13231aaff39c578119b.zip | |
Do not include object string representation in `NoMethodError` message.
This information is not mandatory but causes a lot of problems in the
past due to infinite recursion by redefining `to_str`, `inspect` etc.
Diffstat (limited to 'src')
| -rw-r--r-- | src/kernel.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/kernel.c b/src/kernel.c index 1ac49ed04..e9dc93bbd 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -956,26 +956,7 @@ mrb_obj_remove_instance_variable(mrb_state *mrb, mrb_value self) void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args) { - mrb_sym inspect; - mrb_value repr; - - inspect = mrb_intern_lit(mrb, "inspect"); - if (mrb->c->ci > mrb->c->cibase && mrb->c->ci[-1].mid == inspect) { - /* method missing in inspect; avoid recursion */ - repr = mrb_any_to_s(mrb, self); - } - else if (mrb_respond_to(mrb, self, inspect) && mrb->c->ci - mrb->c->cibase < 16) { - repr = mrb_funcall_argv(mrb, self, inspect, 0, 0); - if (mrb_string_p(repr) && RSTRING_LEN(repr) > 64) { - repr = mrb_any_to_s(mrb, self); - } - } - else { - repr = mrb_any_to_s(mrb, self); - } - - mrb_no_method_error(mrb, name, args, "undefined method '%S' for %S", - mrb_sym2str(mrb, name), repr); + mrb_no_method_error(mrb, name, args, "undefined method '%S'", mrb_sym2str(mrb, name)); } /* 15.3.1.3.30 */ |
