ruby-changes:47283
From: nagachika <ko1@a...>
Date: Sun, 23 Jul 2017 16:30:49 +0900 (JST)
Subject: [ruby-changes:47283] nagachika:r59398 (ruby_2_4): merge revision(s) 58693: [Backport #13558]
nagachika 2017-07-23 16:30:43 +0900 (Sun, 23 Jul 2017) New Revision: 59398 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59398 Log: merge revision(s) 58693: [Backport #13558] array.c: check position to insert * array.c (rb_ary_insert): check position to insert even if no elements to be inserted. [ruby-core:81125] [Bug #13558] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/array.c branches/ruby_2_4/test/ruby/test_array.rb branches/ruby_2_4/version.h Index: ruby_2_4/array.c =================================================================== --- ruby_2_4/array.c (revision 59397) +++ ruby_2_4/array.c (revision 59398) @@ -1775,8 +1775,8 @@ rb_ary_insert(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_4/array.c#L1775 rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS); rb_ary_modify_check(ary); - if (argc == 1) return ary; pos = NUM2LONG(argv[0]); + if (argc == 1) return ary; if (pos == -1) { pos = RARRAY_LEN(ary); } Index: ruby_2_4/test/ruby/test_array.rb =================================================================== --- ruby_2_4/test/ruby/test_array.rb (revision 59397) +++ ruby_2_4/test/ruby/test_array.rb (revision 59398) @@ -2102,6 +2102,7 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_array.rb#L2102 assert_equal([0], a.insert(1)) assert_equal([0, 1], a.insert(1, 1)) assert_raise(ArgumentError) { a.insert } + assert_raise(TypeError) { a.insert(Object.new) } assert_equal([0, 1, 2], a.insert(-1, 2)) assert_equal([0, 1, 3, 2], a.insert(-2, 3)) assert_raise(RuntimeError) { [0].freeze.insert(0)} Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59397) +++ ruby_2_4/version.h (revision 59398) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.2" #define RUBY_RELEASE_DATE "2017-07-23" -#define RUBY_PATCHLEVEL 149 +#define RUBY_PATCHLEVEL 150 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 7 Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59397) +++ ruby_2_4 (revision 59398) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58693 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/