From fb2941a4ec60cd396982f15e990696f733703e37 Mon Sep 17 00:00:00 2001 From: marcandre Date: Wed, 13 Jan 2010 02:57:48 +0000 Subject: [PATCH] * object.c (rb_class_initialize): Make sure BasicObject doesn't get initialized twice [ruby-core:27577] * class.c (rb_class_init_copy): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ class.c | 2 +- object.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87a5044c2f..d20c69b0e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Jan 13 11:57:38 2010 Marc-Andre Lafortune + + * object.c (rb_class_initialize): Make sure BasicObject doesn't get + initialized twice [ruby-core:27577] + + * class.c (rb_class_init_copy): ditto + Wed Jan 13 06:54:44 2010 Nobuyoshi Nakada * configure.in: check for if struct timezone is defined. diff --git a/class.c b/class.c index 599cbd689e..6674ae1a9d 100644 --- a/class.c +++ b/class.c @@ -180,7 +180,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig) VALUE rb_class_init_copy(VALUE clone, VALUE orig) { - if (RCLASS_SUPER(clone) != 0) { + if (RCLASS_SUPER(clone) != 0 || clone == rb_cBasicObject) { rb_raise(rb_eTypeError, "already initialized class"); } if (FL_TEST(orig, FL_SINGLETON)) { diff --git a/object.c b/object.c index 58ca4c1267..73e5bd12a2 100644 --- a/object.c +++ b/object.c @@ -1427,7 +1427,7 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass) { VALUE super; - if (RCLASS_SUPER(klass) != 0) { + if (RCLASS_SUPER(klass) != 0 || klass == rb_cBasicObject) { rb_raise(rb_eTypeError, "already initialized class"); } if (argc == 0) {