Bug #14670
closed
Objectで定義したmethod_missingでsuperが使えない
Added by keiju (Keiju Ishitsuka) over 6 years ago.
Updated over 6 years ago.
Description
class Object
def method_missing(name, *args, &block)
super
end
end
Object.new.foo
を実行すると, SystemStackError
になってしまいます.
再定義する先がObject
でなければ(Object
のサブクラスなら)問題ないです.
- Related to Feature #14313: Support creating KeyError with receiver and key from Ruby added
- Description updated (diff)
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED
- Status changed from Open to Closed
Applied in changeset trunk|r63136.
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.
Also available in: Atom
PDF
Like0
Like0Like0Like0