ruby-changes:33012
From: usa <ko1@a...>
Date: Sat, 22 Feb 2014 09:50:38 +0900 (JST)
Subject: [ruby-changes:33012] usa:r45091 (ruby_1_9_3): merge revision(s) 45076: [Backport #9535]
usa 2014-02-22 09:50:33 +0900 (Sat, 22 Feb 2014) New Revision: 45091 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45091 Log: merge revision(s) 45076: [Backport #9535] * class.c (rb_mod_init_copy): do nothing if copying self. [ruby-dev:47989] [Bug #9535] * hash.c (rb_hash_initialize_copy): ditto. Modified directories: branches/ruby_1_9_3/ Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/class.c branches/ruby_1_9_3/ext/json/generator/generator.c branches/ruby_1_9_3/ext/zlib/zlib.c branches/ruby_1_9_3/test/ruby/test_hash.rb branches/ruby_1_9_3/test/ruby/test_module.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 45090) +++ ruby_1_9_3/ChangeLog (revision 45091) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1 +Sat Feb 22 09:26:05 2014 Nobuyoshi Nakada <nobu@r...> + + * class.c (rb_mod_init_copy): do nothing if copying self. + [ruby-dev:47989] [Bug #9535] + Tue Feb 18 22:53:34 2014 NAKAMURA Usaku <usa@r...> * ruby_atomic.h: fixed merge mistake of r44946. reported by ngoto at Index: ruby_1_9_3/class.c =================================================================== --- ruby_1_9_3/class.c (revision 45090) +++ ruby_1_9_3/class.c (revision 45091) @@ -180,6 +180,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/class.c#L180 if (RB_TYPE_P(clone, T_CLASS)) { class_init_copy_check(clone, orig); } + if (clone == orig) return clone; rb_obj_init_copy(clone, orig); if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) { RBASIC(clone)->klass = rb_singleton_class_clone(orig); Index: ruby_1_9_3/ext/zlib/zlib.c =================================================================== --- ruby_1_9_3/ext/zlib/zlib.c (revision 45090) +++ ruby_1_9_3/ext/zlib/zlib.c (revision 45091) @@ -1334,6 +1334,7 @@ rb_deflate_init_copy(VALUE self, VALUE o https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/zlib/zlib.c#L1334 Data_Get_Struct(self, struct zstream, z1); z2 = get_zstream(orig); + if (z1 == z2) return self; err = deflateCopy(&z1->stream, &z2->stream); if (err != Z_OK) { raise_zlib_error(err, 0); Index: ruby_1_9_3/ext/json/generator/generator.c =================================================================== --- ruby_1_9_3/ext/json/generator/generator.c (revision 45090) +++ ruby_1_9_3/ext/json/generator/generator.c (revision 45091) @@ -1033,6 +1033,7 @@ static VALUE cState_init_copy(VALUE obj, https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/generator/generator.c#L1033 { JSON_Generator_State *objState, *origState; + if (obj == orig) return obj; Data_Get_Struct(obj, JSON_Generator_State, objState); Data_Get_Struct(orig, JSON_Generator_State, origState); if (!objState) rb_raise(rb_eArgError, "unallocated JSON::State"); Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 45090) +++ ruby_1_9_3/version.h (revision 45091) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1 #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 537 +#define RUBY_PATCHLEVEL 538 -#define RUBY_RELEASE_DATE "2014-02-19" +#define RUBY_RELEASE_DATE "2014-02-22" #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 19 +#define RUBY_RELEASE_DAY 22 #include "ruby/version.h" Index: ruby_1_9_3/test/ruby/test_module.rb =================================================================== --- ruby_1_9_3/test/ruby/test_module.rb (revision 45090) +++ ruby_1_9_3/test/ruby/test_module.rb (revision 45091) @@ -277,6 +277,17 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_module.rb#L277 assert_equal([:MIXIN, :USER], User.constants.sort) end + def test_self_initialize_copy + bug9535 = '[ruby-dev:47989] [Bug #9535]' + m = Module.new do + def foo + :ok + end + initialize_copy(self) + end + assert_equal(:ok, Object.new.extend(m).foo, bug9535) + end + def test_included_modules assert_equal([], Mixin.included_modules) assert_equal([Mixin], User.included_modules) Index: ruby_1_9_3/test/ruby/test_hash.rb =================================================================== --- ruby_1_9_3/test/ruby/test_hash.rb (revision 45090) +++ ruby_1_9_3/test/ruby/test_hash.rb (revision 45091) @@ -117,6 +117,12 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_hash.rb#L117 end + def test_self_initialize_copy + h = @cls[1=>2] + h.instance_eval {initialize_copy(h)} + assert_equal(2, h[1]) + end + def test_AREF # '[]' t = Time.now h = @cls[ @@ -145,8 +151,6 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_hash.rb#L151 assert_equal('nil', h1[nil]) assert_equal(nil, h1['nil']) assert_equal(:default, h1['koala']) - - end def test_ASET # '[]=' Property changes on: ruby_1_9_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r45076 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/