ruby-changes:30857
From: nagachika <ko1@a...>
Date: Fri, 13 Sep 2013 23:31:55 +0900 (JST)
Subject: [ruby-changes:30857] nagachika:r42936 (ruby_2_0_0): merge revision(s) 42541: [Backport #8903]
nagachika 2013-09-13 23:31:46 +0900 (Fri, 13 Sep 2013) New Revision: 42936 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42936 Log: merge revision(s) 42541: [Backport #8903] * object.c (Init_Object): undef Module#prepend_features on Class, as well as Module#append_features. [Fixes GH-376] * test_class.rb: Added test for above. And ensure type checking on similar methods as module_function. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/object.c branches/ruby_2_0_0/test/ruby/test_class.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42935) +++ ruby_2_0_0/ChangeLog (revision 42936) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Sep 13 23:20:29 2013 Kenichi Kamiya <kachick1@g...> + + * object.c (Init_Object): undef Module#prepend_features on Class, as + well as Module#append_features. [Fixes GH-376] + + * test_class.rb: Added test for above. And ensure type checking + on similar methods as module_function. + Fri Sep 13 23:16:12 2013 Zachary Scott <e@z...> * enumerator.c: [DOC] Remove reference to Enumerator::Lazy#cycle Index: ruby_2_0_0/object.c =================================================================== --- ruby_2_0_0/object.c (revision 42935) +++ ruby_2_0_0/object.c (revision 42936) @@ -3163,6 +3163,7 @@ Init_Object(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L3163 rb_define_alloc_func(rb_cClass, rb_class_s_alloc); rb_undef_method(rb_cClass, "extend_object"); rb_undef_method(rb_cClass, "append_features"); + rb_undef_method(rb_cClass, "prepend_features"); /* * Document-class: Data Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42935) +++ ruby_2_0_0/version.h (revision 42936) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-09-13" -#define RUBY_PATCHLEVEL 311 +#define RUBY_PATCHLEVEL 312 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_0_0/test/ruby/test_class.rb =================================================================== --- ruby_2_0_0/test/ruby/test_class.rb (revision 42935) +++ ruby_2_0_0/test/ruby/test_class.rb (revision 42936) @@ -105,6 +105,32 @@ class TestClass < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_class.rb#L105 end end + def test_extend_object + c = Class.new + assert_raise(TypeError) do + Module.instance_method(:extend_object).bind(c).call(Object.new) + end + end + + def test_append_features + c = Class.new + assert_raise(TypeError) do + Module.instance_method(:append_features).bind(c).call(Module.new) + end + end + + def test_prepend_features + c = Class.new + assert_raise(TypeError) do + Module.instance_method(:prepend_features).bind(c).call(Module.new) + end + end + + def test_module_specific_methods + assert_empty(Class.private_instance_methods(true) & + [:module_function, :extend_object, :append_features, :prepend_features]) + end + def test_method_redefinition feature2155 = '[ruby-dev:39400]' Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42541 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/