ruby-changes:47404
From: nagachika <ko1@a...>
Date: Sat, 5 Aug 2017 16:00:40 +0900 (JST)
Subject: [ruby-changes:47404] nagachika:r59520 (ruby_2_4): merge revision(s) 59457: [Backport #13775]
nagachika 2017-08-05 16:00:33 +0900 (Sat, 05 Aug 2017) New Revision: 59520 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59520 Log: merge revision(s) 59457: [Backport #13775] should not copy promoted flags. * include/ruby/ruby.h (rb_clone_setup): should not copy some flags (FL_PROMOTED0|FL_PROMOTED1|FL_FINALIZE). [Bug #13775] * test/ruby/test_object.rb: add a test (note that this test will fail only when RGENGC_CHECK_MODE >= 2). Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/include/ruby/ruby.h branches/ruby_2_4/test/ruby/test_object.rb branches/ruby_2_4/version.h Index: ruby_2_4/test/ruby/test_object.rb =================================================================== --- ruby_2_4/test/ruby/test_object.rb (revision 59519) +++ ruby_2_4/test/ruby/test_object.rb (revision 59520) @@ -920,4 +920,14 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_object.rb#L920 num.times {a.clone.set} end; end + + def test_clone_object_should_not_be_old + assert_normal_exit <<-EOS, '[Bug #13775]' + b = proc { } + 10.times do |i| + b.clone + GC.start + end + EOS + end end Index: ruby_2_4/include/ruby/ruby.h =================================================================== --- ruby_2_4/include/ruby/ruby.h (revision 59519) +++ ruby_2_4/include/ruby/ruby.h (revision 59520) @@ -2007,7 +2007,8 @@ rb_special_const_p(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/include/ruby/ruby.h#L2007 static inline void rb_clone_setup(VALUE clone, VALUE obj) { - rb_obj_setup(clone, rb_singleton_class_clone(obj), RBASIC(obj)->flags); + rb_obj_setup(clone, rb_singleton_class_clone(obj), + RBASIC(obj)->flags & ~(FL_PROMOTED0|FL_PROMOTED1|FL_FINALIZE)); rb_singleton_class_attached(RBASIC_CLASS(clone), clone); if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(clone, obj); } Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59519) +++ ruby_2_4/version.h (revision 59520) @@ -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-08-05" -#define RUBY_PATCHLEVEL 180 +#define RUBY_PATCHLEVEL 181 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59519) +++ ruby_2_4 (revision 59520) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59457 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/