From 4f9f2243e9fc0fd0e0d4334b54b2cad7282f4ac1 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 22 May 2025 14:18:03 -0700 Subject: [PATCH] Stricter assert for RCLASS_ALLOCATOR I'd like to make this only valid to T_CLASS also, but currently it is called in some places for T_ICLASS and expected to return 0. --- internal/class.h | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/class.h b/internal/class.h index 4a3e0afafb..b6da66a61d 100644 --- a/internal/class.h +++ b/internal/class.h @@ -658,6 +658,7 @@ RCLASS_SET_REFINED_CLASS(VALUE klass, VALUE refined) static inline rb_alloc_func_t RCLASS_ALLOCATOR(VALUE klass) { + RUBY_ASSERT(RB_TYPE_P(klass, T_CLASS) || RB_TYPE_P(klass, T_ICLASS)); if (RCLASS_SINGLETON_P(klass) || RB_TYPE_P(klass, T_ICLASS)) { return 0; }