summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-05 07:00:33 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-05 07:00:33 +0000
commit5013a509cdf8633e908648680f5104ec544ead4c (patch)
tree80a2938555ea966c7c79894650eb74816482dec0
parent23390a82e606ac53a3f9567c98405b19df713feb (diff)
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). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--include/ruby/ruby.h3
-rw-r--r--test/ruby/test_object.rb10
-rw-r--r--version.h2
3 files changed, 13 insertions, 2 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 5ca1f9cc55..34004a13c3 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -2007,7 +2007,8 @@ rb_special_const_p(VALUE obj)
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);
}
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb
index 7c1b98f76e..5ef1497869 100644
--- a/test/ruby/test_object.rb
+++ b/test/ruby/test_object.rb
@@ -920,4 +920,14 @@ class TestObject < Test::Unit::TestCase
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
diff --git a/version.h b/version.h
index fde07baf7a..abaff37fc2 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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