StringIO#dup behavior differs from MRI --------------------------------------
Key: JRUBY-4318 URL: http://jira.codehaus.org/browse/JRUBY-4318 Project: JRuby Issue Type: Bug Components: Extensions Environment: latest jruby Reporter: Vladimir Sizikov Assignee: Vladimir Sizikov Fix For: JRuby 1.5 The following test from MRI 1.8-dev fails with JRuby: {code} def test_dup f1 = StringIO.new("1234") assert_equal(?1, f1.getc) f2 = f1.dup assert_equal(?2, f2.getc) assert_equal(?3, f1.getc) assert_equal(?4, f2.getc) assert_equal(nil, f1.getc) assert_equal(true, f2.eof?) f1.close assert_equal(true, f2.closed?) ensure f1.close unless f1.closed? if f1 f2.close unless f2.closed? if f2 end {code} Apparently, StringIO's dup makes two StringIO objects to share the same data (position, eof status, etc), and reading via one instance changes both instances. In JRuby, both instances share the same values at the moment of duplication, but then they are independent (which is different from MRI). Will fix. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email