You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading from commit 36fc1f1 to 3703aed a regression is observed in the behavior of instance_eval. In this period I see 6 commits to eval.c:
fca17b4 Avoid trampoline when #eval is called from mrb_funcall(); fix #3522
f8b31a0 `instance_eval` method does not introduce C function boundary; fix #3508
73e5a19 Configure callinfo target_class as CRuby; ref #3429
097da23 Avoid executing OP_STOP in eval(); fix #3429
5e3c329 Adjust callinfo env and target_class; ref #3429
48e0bbb Make `eval` to use trampoline technique; fix #3415
Presumably one of these commits is setting the target class for instance eval incorrectly. The test case used to observe the behavior is shown below:
class A
def method
:a
end
end
class B
def initialize()
@a = A.new
@a.instance_eval "def method;:a_eval;end"
nil
end
attr_reader :a
def method
:b
end
end
a = A.new
b = B.new
puts "Expected unmodified method value ':a'. Got '#{a.method}'"
puts "Expected unmodified method value ':b'. Got '#{b.method}'"
puts "Expected modified method value ':a_eval'. Got '#{b.a.method}'"
Behavior observed with mruby and CRuby (2.2.3p173) show the bug:
mark@darkstar:~/mytmp/mruby$ ruby instance_eval_test.rb
Expected unmodified method value ':a'. Got 'a'
Expected unmodified method value ':b'. Got 'b'
Expected modified method value ':a_eval'. Got 'a_eval'
mark@darkstar:~/mytmp/mruby$ ./bin/mruby instance_eval_test.rb
Expected unmodified method value ':a'. Got 'a'
Expected unmodified method value ':b'. Got 'a_eval'
Expected modified method value ':a_eval'. Got 'a'
The text was updated successfully, but these errors were encountered:
Some quick printf() based debugging latter it looks like the RProc's target_class field might be being ignored in the mrb_exec_irep() function in vm.c.
When upgrading from commit 36fc1f1 to 3703aed a regression is observed in the behavior of instance_eval. In this period I see 6 commits to eval.c:
Presumably one of these commits is setting the target class for instance eval incorrectly. The test case used to observe the behavior is shown below:
Behavior observed with mruby and CRuby (2.2.3p173) show the bug:
The text was updated successfully, but these errors were encountered: