Project

General

Profile

Bug #14670

Objectで定義したmethod_missingでsuperが使えない

Added by keiju (Keiju Ishitsuka) about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-dev:50522]

Description

class Object
  def method_missing(name, *args, &block)
    super
  end
end

Object.new.foo

を実行すると, SystemStackError になってしまいます.

再定義する先がObjectでなければ(Objectのサブクラスなら)問題ないです.


Related issues

Related to Ruby master - Feature #14313: Support creating KeyError with receiver and key from RubyClosedmatz (Yukihiro Matsumoto)Actions
#1

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Related to Feature #14313: Support creating KeyError with receiver and key from Ruby added
#2

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED
  • Description updated (diff)
#3

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • 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