Skip to content
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

Binding#dup should actually dup the runtime structures in 1.9 mode #309

Closed
headius opened this issue Sep 25, 2012 · 2 comments
Closed

Binding#dup should actually dup the runtime structures in 1.9 mode #309

headius opened this issue Sep 25, 2012 · 2 comments
Assignees
Labels
Milestone

Comments

@headius
Copy link
Member

headius commented Sep 25, 2012

The following code should error out, because the bindings are all being dup'ed before use:

system ~/projects/jruby $ jruby -e "b = binding; eval 'a = 1', b.dup; eval 'p a', b.dup"
1

system ~/projects/jruby $ ruby-1.9.3 -e "b = binding; eval 'a = 1', b.dup; eval 'p a', b.dup"
-e:1:in `<main>': undefined local variable or method `a' for main:Object (NameError)
    from -e:1:in `eval'
    from -e:1:in `<main>'

This is needed for e.g. a more efficient fix for https://bugs.ruby-lang.org/issues/7046

@MSNexploder
Copy link
Contributor

Fixed on both - 1.7.18 and master

jruby -v && jruby -e "b = binding; eval 'a = 1', b.dup; eval 'p a', b.dup"
jruby 1.7.18 (1.9.3p551) 2014-12-22 625381c on Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17 [darwin-x86_64]
NameError: undefined local variable or method `a' for main:Object
  (root) at -e:1
    eval at org/jruby/RubyKernel.java:1107
  (root) at -e:1

jruby -v && jruby -e "b = binding; eval 'a = 1', b.dup; eval 'p a', b.dup"
jruby 9.0.0.0-SNAPSHOT (2.2.0p0) 2015-01-01 fb9199f Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
NameError: undefined local variable or method `a' for main:Object
  (root) at -e:1
    eval at org/jruby/RubyKernel.java:990
  (root) at -e:1

@headius
Copy link
Member Author

headius commented Jan 2, 2015

Awesome, thanks for checking and reporting back!

@headius headius closed this as completed Jan 2, 2015
@headius headius added this to the JRuby 1.7.18 milestone Jan 2, 2015
@headius headius self-assigned this Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants