summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-04-14 18:02:12 -0700
committerJohn Hawthorn <john@hawthorn.email>2025-05-12 14:10:29 -0700
commitb0502e8f904f155ac077014077431ed5e54b9996 (patch)
tree53803afedec1d3503a048565ef8ec89d2bd852a1 /object.c
parentc6528548d04cb918f424885111a2d6ae9516518d (diff)
Remove respond_to check from Class#bind_call
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13116
Diffstat (limited to 'object.c')
-rw-r--r--object.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/object.c b/object.c
index 45213c8e61..85b96fe31a 100644
--- a/object.c
+++ b/object.c
@@ -2139,17 +2139,6 @@ static VALUE class_call_alloc_func(rb_alloc_func_t allocator, VALUE klass);
*/
static VALUE
-rb_class_alloc_m(VALUE klass)
-{
- rb_alloc_func_t allocator = class_get_alloc_func(klass);
- if (!rb_obj_respond_to(klass, rb_intern("allocate"), 1)) {
- rb_raise(rb_eTypeError, "calling %"PRIsVALUE".allocate is prohibited",
- klass);
- }
- return class_call_alloc_func(allocator, klass);
-}
-
-static VALUE
rb_class_alloc(VALUE klass)
{
rb_alloc_func_t allocator = class_get_alloc_func(klass);
@@ -4603,8 +4592,8 @@ InitVM_Object(void)
rb_define_method(rb_cModule, "deprecate_constant", rb_mod_deprecate_constant, -1); /* in variable.c */
rb_define_method(rb_cModule, "singleton_class?", rb_mod_singleton_p, 0);
- rb_define_method(rb_singleton_class(rb_cClass), "allocate", rb_class_alloc_m, 0);
- rb_define_method(rb_cClass, "allocate", rb_class_alloc_m, 0);
+ rb_define_method(rb_singleton_class(rb_cClass), "allocate", rb_class_alloc, 0);
+ rb_define_method(rb_cClass, "allocate", rb_class_alloc, 0);
rb_define_method(rb_cClass, "new", rb_class_new_instance_pass_kw, -1);
rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1);
rb_define_method(rb_cClass, "superclass", rb_class_superclass, 0);