mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Remove respond_to check from Class#bind_call
This commit is contained in:
parent
c6528548d0
commit
b0502e8f90
Notes:
git
2025-05-12 21:10:42 +00:00
3 changed files with 5 additions and 19 deletions
15
object.c
15
object.c
|
@ -2138,17 +2138,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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue