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

ruby-changes:58424

From: Koichi <ko1@a...>
Date: Fri, 25 Oct 2019 04:02:29 +0900 (JST)
Subject: [ruby-changes:58424] e8f90e7397 (master): check T_ICLASS for Method#inspect.

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

From e8f90e73978c0321021c177fe3fa2623a8b3a4de Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Fri, 25 Oct 2019 04:01:02 +0900
Subject: check T_ICLASS for Method#inspect.

METHOD::klass can contain T_ICLASS so inspect should respect it.

diff --git a/proc.c b/proc.c
index ca6e671..4dfcf67 100644
--- a/proc.c
+++ b/proc.c
@@ -2819,6 +2819,14 @@ method_inspect(VALUE method) https://github.com/ruby/ruby/blob/trunk/proc.c#L2819
 
     mklass = data->klass;
 
+    if (RB_TYPE_P(mklass, T_ICLASS)) {
+        /* TODO: I'm not sure why mklass is T_ICLASS.
+         * UnboundMethod#bind() can set it as T_ICLASS at convert_umethod_to_method_components()
+         * but not sure it is needed.
+         */
+        mklass = RBASIC_CLASS(mklass);
+    }
+
     if (data->me->def->type == VM_METHOD_TYPE_ALIAS) {
 	defined_class = data->me->def->body.alias.original_me->owner;
     }
-- 
cgit v0.10.2


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

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