summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--test/lib/test/unit/assertions.rb1
-rw-r--r--test/ruby/test_marshal.rb20
-rw-r--r--version.h2
-rw-r--r--vm_method.c2
5 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 91012157b0..81bde74105 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Aug 12 03:50:38 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* variable.c (rb_local_constants_i): exclude private constants
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index 4396503447..9a1cacd5a9 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -186,7 +186,6 @@ module Test
raise
end
end
- nil
end
# :call-seq:
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index e2e321bb41..38e03ac57b 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -736,4 +736,24 @@ class TestMarshal < Test::Unit::TestCase
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
diff --git a/version.h b/version.h
index c9123f8ef1..6360040c9e 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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
diff --git a/vm_method.c b/vm_method.c
index 24f37dc85f..7f4af53518 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1916,7 +1916,7 @@ vm_respond_to(rb_thread_t *th, VALUE klass, VALUE obj, ID id, int priv)
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;
}