ruby-changes:68021
From: Nobuyoshi <ko1@a...>
Date: Fri, 17 Sep 2021 19:05:20 +0900 (JST)
Subject: [ruby-changes:68021] fd918d1afa (master): Removed Module.allocate [Bug #17048]
https://git.ruby-lang.org/ruby.git/commit/?id=fd918d1afa From fd918d1afa89405c194e90476373f936b3577df0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 26 Jul 2020 13:20:19 +0900 Subject: Removed Module.allocate [Bug #17048] --- object.c | 2 ++ spec/ruby/core/module/allocate_spec.rb | 14 -------------- test/ruby/test_module.rb | 12 ------------ 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 spec/ruby/core/module/allocate_spec.rb diff --git a/object.c b/object.c index 5263618..56095e9 100644 --- a/object.c +++ b/object.c @@ -4612,6 +4612,7 @@ InitVM_Object(void) https://github.com/ruby/ruby/blob/trunk/object.c#L4612 rb_define_method(rb_cModule, "attr_accessor", rb_mod_attr_accessor, -1); rb_define_alloc_func(rb_cModule, rb_module_s_alloc); + rb_undef_method(rb_singleton_class(rb_cModule), "allocate"); rb_define_method(rb_cModule, "initialize", rb_mod_initialize, 0); rb_define_method(rb_cModule, "initialize_clone", rb_mod_initialize_clone, -1); rb_define_method(rb_cModule, "instance_methods", rb_class_instance_methods, -1); /* in class.c */ @@ -4643,6 +4644,7 @@ InitVM_Object(void) https://github.com/ruby/ruby/blob/trunk/object.c#L4644 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_cClass, "new", rb_class_new_instance_pass_kw, -1); rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1); diff --git a/spec/ruby/core/module/allocate_spec.rb b/spec/ruby/core/module/allocate_spec.rb deleted file mode 100644 index 3b2c411..0000000 --- a/spec/ruby/core/module/allocate_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/object.c#L0 -require_relative '../../spec_helper' - -describe "Module.allocate" do - it "returns an instance of Module" do - mod = Module.allocate - mod.should be_an_instance_of(Module) - end - - it "returns a fully-formed instance of Module" do - mod = Module.allocate - mod.constants.should_not == nil - mod.methods.should_not == nil - end -end diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index bbe84cd..b36b8b7 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -3094,18 +3094,6 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L3094 assert_match(/::Foo$/, mod.name, '[Bug #14895]') end - def test_include_allocated - assert_raise(ArgumentError) do - Module.new {include Module.allocate} - end - assert_raise(ArgumentError) do - Module.new {prepend Module.allocate} - end - assert_raise(ArgumentError) do - Object.new.extend Module.allocate - end - end - private def assert_top_method_is_private(method) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/