Skip to content

Commit a2a69b4

Browse files
committed
Add assertion to rb_class_alloc
We should only ever call rb_class_alloc with a T_CLASS. Adding this assert/assumption allows us to elide later checks for T_CLASS>
1 parent 2021146 commit a2a69b4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,7 @@ static VALUE class_call_alloc_func(rb_alloc_func_t allocator, VALUE klass);
22682268
static VALUE
22692269
rb_class_alloc(VALUE klass)
22702270
{
2271+
RBIMPL_ASSERT_TYPE(klass, T_CLASS);
22712272
rb_alloc_func_t allocator = class_get_alloc_func(klass);
22722273
return class_call_alloc_func(allocator, klass);
22732274
}

0 commit comments

Comments
 (0)