[#70257] [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI — ko1@...

Issue #11420 has been reported by Koichi Sasada.

11 messages 2015/08/06

[ruby-core:70393] [Ruby trunk - Bug #11445] [Rejected] Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance

From: nobu@...
Date: 2015-08-14 21:48:47 UTC
List: ruby-core #70393
Issue #11445 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Open to Rejected

1.9 has finished.

----------------------------------------
Bug #11445: Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance
https://bugs.ruby-lang.org/issues/11445#change-53794

* Author: Michal Brun叩t
* Status: Rejected
* Priority: Normal
* Assignee: 
* ruby -v: ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
* Backport: 1.9.3: UNKNOWN
----------------------------------------
In Ruby 1.9.3 cloned `StringIO` instance has influence on close state of original instance:

~~~ruby
require 'stringio'

sio1 = StringIO.new( 'abc' )
sio2 = sio1.clone

sio2.read
sio1.pos  # => 3, expected 0

sio2.close
sio1.closed?  # => true, expected false
~~~

If `File` is used instead of `StringIO`, close state is not shared between instances (position is).

This behaviour has changed in Ruby 2.0.0 (cloned `StringIO` instance does not close original instance).

It matters what definition for `IO` clone is, whether to share attributes (e.g. `pos`) and/or state (`closed?`) but the later is acting differently in 1.9.3 for `StringIO` and `File`.




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next