[前][次][番号順一覧][スレッド一覧]

ruby-changes:62426

From: Nobuyoshi <ko1@a...>
Date: Thu, 30 Jul 2020 02:29:09 +0900 (JST)
Subject: [ruby-changes:62426] 28cd254b49 (master): Set cloned flag after checked if copiable

https://git.ruby-lang.org/ruby.git/commit/?id=28cd254b49

From 28cd254b498e34b3fb205cfb116bff3f946d2fdc Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 30 Jul 2020 02:28:46 +0900
Subject: Set cloned flag after checked if copiable


diff --git a/class.c b/class.c
index 6835d2d..0d97603 100644
--- a/class.c
+++ b/class.c
@@ -354,16 +354,17 @@ static void ensure_origin(VALUE klass); https://github.com/ruby/ruby/blob/trunk/class.c#L354
 VALUE
 rb_mod_init_copy(VALUE clone, VALUE orig)
 {
+    if (RB_TYPE_P(clone, T_CLASS)) {
+        class_init_copy_check(clone, orig);
+    }
+    if (!OBJ_INIT_COPY(clone, orig)) return clone;
+
     /* cloned flag is refer at constant inline cache
      * see vm_get_const_key_cref() in vm_insnhelper.c
      */
     FL_SET(clone, RCLASS_CLONED);
     FL_SET(orig , RCLASS_CLONED);
 
-    if (RB_TYPE_P(clone, T_CLASS)) {
-        class_init_copy_check(clone, orig);
-    }
-    if (!OBJ_INIT_COPY(clone, orig)) return clone;
     if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
         RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig));
         rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]