ruby-changes:26579
From: glass <ko1@a...>
Date: Thu, 27 Dec 2012 21:21:47 +0900 (JST)
Subject: [ruby-changes:26579] glass:r38630 (trunk): * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
glass 2012-12-27 21:21:17 +0900 (Thu, 27 Dec 2012) New Revision: 38630 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38630 Log: * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError when limit is nil. [Bug #7232] [ruby-core:48531] * test/stringio/test_stringio.rb: a test for above. Modified files: trunk/ChangeLog trunk/ext/stringio/stringio.c trunk/test/stringio/test_stringio.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38629) +++ ChangeLog (revision 38630) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Dec 27 20:45:29 2012 Masaki Matsushita <glass.saga@g...> + + * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError + when limit is nil. + [Bug #7232] [ruby-core:48531] + + * test/stringio/test_stringio.rb: a test for above. + Thu Dec 27 21:08:23 2012 Charlie Somerville <charlie@c...> * vm_core.h (VM_DEFINECLASS_TYPE): explicit cast to enum type to avoid 64->32 Index: ext/stringio/stringio.c =================================================================== --- ext/stringio/stringio.c (revision 38629) +++ ext/stringio/stringio.c (revision 38630) @@ -987,7 +987,7 @@ strio_getline(int argc, VALUE *argv, str https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L987 case 2: if (!NIL_P(str)) StringValue(str); - limit = NUM2LONG(lim); + if (!NIL_P(lim)) limit = NUM2LONG(lim); break; } Index: test/stringio/test_stringio.rb =================================================================== --- test/stringio/test_stringio.rb (revision 38629) +++ test/stringio/test_stringio.rb (revision 38630) @@ -52,7 +52,7 @@ class TestStringIO < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/stringio/test_stringio.rb#L52 assert_equal("abc\n\ndef\n", StringIO.new("abc\n\ndef\n").gets(nil)) assert_equal("abc\n\n", StringIO.new("abc\n\ndef\n").gets("")) assert_raise(TypeError){StringIO.new("").gets(1, 1)} - assert_raise(TypeError){StringIO.new("").gets(nil, nil)} + assert_nothing_raised {StringIO.new("").gets(nil, nil)} end def test_readlines -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/