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

ruby-changes:71981

From: John <ko1@a...>
Date: Sat, 28 May 2022 05:39:00 +0900 (JST)
Subject: [ruby-changes:71981] fc184ca1f7 (master): Only check class ancestors for ivar in memory_view

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

From fc184ca1f789ce6a89e83b9247b6bd172af7c659 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Sun, 6 Feb 2022 13:48:09 -0800
Subject: Only check class ancestors for ivar in memory_view

rb_class_get_superclass returns the immediate SUPER, including T_ICLASS.
rb_ivar_lookup isn't implemented for T_ICLASS so it uses the default
behaviour, which always returns Qnil.

This commit avoids checking T_ICLASS for ivars.
---
 memory_view.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/memory_view.c b/memory_view.c
index 637d427e86..935b8d983f 100644
--- a/memory_view.c
+++ b/memory_view.c
@@ -784,7 +784,7 @@ lookup_memory_view_entry(VALUE klass) https://github.com/ruby/ruby/blob/trunk/memory_view.c#L784
 {
     VALUE entry_obj = rb_ivar_lookup(klass, id_memory_view, Qnil);
     while (NIL_P(entry_obj)) {
-        klass = rb_class_get_superclass(klass);
+        klass = rb_class_superclass(klass);
 
         if (klass == rb_cBasicObject || klass == rb_cObject)
             return NULL;
-- 
cgit v1.2.1


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

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