ruby-changes:43796
From: nagachika <ko1@a...>
Date: Fri, 12 Aug 2016 03:58:17 +0900 (JST)
Subject: [ruby-changes:43796] nagachika:r55869 (ruby_2_3): merge revision(s) 54142, 55500: [Backport #12353]
nagachika 2016-08-12 03:58:11 +0900 (Fri, 12 Aug 2016) New Revision: 55869 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55869 Log: merge revision(s) 54142,55500: [Backport #12353] assertions.rb: fix result of assert_nothing_raised * test/lib/test/unit/assertions.rb (assert_nothing_raised): do not discard the result of the given block. * vm_method.c (vm_respond_to): try method_missing if respond_to? is undefined, as if it is the default definition. [ruby-core:75377] [Bug #12353] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/test/lib/test/unit/assertions.rb branches/ruby_2_3/test/ruby/test_marshal.rb branches/ruby_2_3/version.h branches/ruby_2_3/vm_method.c Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 55868) +++ ruby_2_3/version.h (revision 55869) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-08-12" -#define RUBY_PATCHLEVEL 149 +#define RUBY_PATCHLEVEL 150 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 55868) +++ ruby_2_3/ChangeLog (revision 55869) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Fri Aug 12 03:50:38 2016 Nobuyoshi Nakada <nobu@r...> + + * vm_method.c (vm_respond_to): try method_missing if respond_to? + is undefined, as if it is the default definition. + [ruby-core:75377] [Bug #12353] + Fri Aug 12 03:30:59 2016 Nobuyoshi Nakada <nobu@r...> * variable.c (rb_local_constants_i): exclude private constants Index: ruby_2_3/vm_method.c =================================================================== --- ruby_2_3/vm_method.c (revision 55868) +++ ruby_2_3/vm_method.c (revision 55869) @@ -1916,7 +1916,7 @@ vm_respond_to(rb_thread_t *th, VALUE kla https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_method.c#L1916 const rb_method_entry_t *const me = method_entry_get(klass, resid, &defined_class); - if (!me) return TRUE; + if (!me) return -1; if (METHOD_ENTRY_BASIC(me)) { return -1; } Index: ruby_2_3/test/lib/test/unit/assertions.rb =================================================================== --- ruby_2_3/test/lib/test/unit/assertions.rb (revision 55868) +++ ruby_2_3/test/lib/test/unit/assertions.rb (revision 55869) @@ -186,7 +186,6 @@ module Test https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/lib/test/unit/assertions.rb#L186 raise end end - nil end # :call-seq: Index: ruby_2_3/test/ruby/test_marshal.rb =================================================================== --- ruby_2_3/test/ruby/test_marshal.rb (revision 55868) +++ ruby_2_3/test/ruby/test_marshal.rb (revision 55869) @@ -736,4 +736,24 @@ class TestMarshal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_marshal.rb#L736 end RUBY end + + MethodMissingWithoutRespondTo = Struct.new(:wrapped_object) do + undef respond_to? + def method_missing(*args, &block) + wrapped_object.public_send(*args, &block) + end + def respond_to_missing?(name, private = false) + wrapped_object.respond_to?(name, false) + end + end + + def test_method_missing_without_respond_to + bug12353 = "[ruby-core:75377] [Bug #12353]: try method_missing if" \ + " respond_to? is undefined" + obj = MethodMissingWithoutRespondTo.new("foo") + dump = assert_nothing_raised(NoMethodError, bug12353) do + Marshal.dump(obj) + end + assert_equal(obj, Marshal.load(dump)) + end end Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r54142,55500 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/