Skip to content

IO.copy_stream does not use duck typing (but MRI 1.9.3 does) #437

@pmahoney

Description

@pmahoney
$ cat test.rb
require 'stringio'
io1 = StringIO.new("hello")
io2 = StringIO.new
IO.copy_stream(io1, io2)
io2.rewind
puts io2.read

$ jruby -v test.rb
jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_35b10-428-10M3811 [darwin-x86_64]
TypeError: Should be String or IO
  copy_stream at org/jruby/RubyIO.java:4153
       (root) at test.rb:4

$ ruby -v test.rb
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0]
hello

See RubyIO.java:4148 and compare to io.c in MRI.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions