New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression In instance_eval #3141

Closed
fundamental opened this Issue Mar 24, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@fundamental

It looks like while fixing issue #3072 at commit fb2e0b7 a regression was introduced to instance_eval.

Test case:

class Foo
    def bar(x)
        instance_eval "def baz; #{x}; end"
    end
end

f1 = Foo.new
f2 = Foo.new
f1.bar 1
f2.bar 2
puts "f1.baz = #{f1.baz} (expected 1)"
puts "f2.baz = #{f2.baz} (expected 2)"

CRuby output:

f1.baz = 1 (expected 1)
f2.baz = 2 (expected 2)

mruby output:

f1.baz = 2 (expected 1)
f2.baz = 2 (expected 2)

Using mrb_run instead of mrb_top_run appears to fix the incorrect behavior demonstrated by the test case, though I assume a somewhat more complex solution may be needed to produce the correct behavior for both this issue and #3072.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment