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

dup on Range regression #3163

etehtsea opened this issue Jul 22, 2015 · 1 comment

dup on Range regression #3163

etehtsea opened this issue Jul 22, 2015 · 1 comment


Copy link

JRuby 9k final:

>>, 1000).dup
NameError: `initialize' called twice
    from org/jruby/ `initialize_copy'
    from org/jruby/ `initialize_dup'
    from org/jruby/ `dup'


=> 0..1000
@enebo enebo added this to the JRuby milestone Jul 22, 2015
Copy link

cheald commented Jul 22, 2015

This was broken in the course of fixing an MRI test:

def test_initialize_twice
  r = eval("1..2")
  assert_raise(NameError) { r.instance_eval { initialize 3, 4 } }
  assert_raise(NameError) { r.instance_eval { initialize_copy 3..4 } }

And apparently #dup calls initialize_copy. I'll get into the MRI source and figure out what it's doing differently.

cheald added a commit to cheald/jruby that referenced this issue Jul 22, 2015
…Closes jruby#3163

MRI checks if the EXCL flag is Qnil to see if the range has been initalized. This doesn't work
in Java because we use a boolean which can't have a nil value. Instead, introduce a new isInited
flag which is used to track the initialization state of the Range, which corrently permits #dup
while not permitting reinitialization of a Range.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants