Project

General

Profile

Actions

Bug #10432

closed

wrong receiver of Binding from Method

Added by nobu (Nobuyoshi Nakada) over 9 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
trunk
[ruby-core:65919]

Description

Methodオブジェクトからto_proc.bindingで作られたBindingのreceiverが、Methodオブジェクトの元になったオブジェクトではなく、Methodオブジェクトになっています。

class C
  def foo;end
end
o = C.new
m = o.method(:foo)
p m.receiver                    # #<C:0x007fcada074e58>
p m.to_proc.binding.receiver    # #<Method: C#foo>

2.0, 2.1ではBinding#receiverはありませんが、eval("self")で同様の結果になります。


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #10428: Segmentation fault when modifying local variables of binding obtained from the result of Method#to_procClosed10/26/2014Actions
Related to Ruby master - Bug #11163: Binding from Method#to_proc.binding cause BUGClosedko1 (Koichi Sasada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0