summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/test/unit/assertions.rb8
-rw-r--r--test/ruby/test_module.rb12
-rw-r--r--version.h2
-rw-r--r--vm_method.c3
5 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 393d14fe15..66e5f8ea93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Apr 12 02:10:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_method.c (rb_export_method): directly override the flag of method
+ defined in prepending class too, not adding zsuper entry.
+ [ruby-core:53106] [Bug #8005]
+
Fri Apr 12 01:57:52 2013 Eric Hodel <drbrain@segment7.net>
* lib/fileutils.rb: Revert r34669 which altered the way
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index 39a3c85600..67a289757b 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -250,7 +250,13 @@ EOT
#
# assert_respond_to("hello", :reverse) #Succeeds
# assert_respond_to("hello", :does_not_exist) #Fails
- def assert_respond_to obj, meth, msg = nil
+ def assert_respond_to obj, (meth, priv), msg = nil
+ if priv
+ msg = message(msg) {
+ "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv}"
+ }
+ return assert obj.respond_to?(meth, priv), msg
+ end
#get rid of overcounting
super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth)
end
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 5450c8ff3a..1e0f154bd2 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1489,6 +1489,18 @@ class TestModule < Test::Unit::TestCase
assert_equal(0, 1 / 2)
end
+ def test_prepend_visibility
+ bug8005 = '[ruby-core:53106] [Bug #8005]'
+ c = Class.new do
+ prepend Module.new {}
+ def foo() end
+ protected :foo
+ end
+ a = c.new
+ assert_respond_to a, [:foo, true]
+ assert_nothing_raised(NoMethodError) {a.send :foo}
+ end
+
def test_class_variables
m = Module.new
m.class_variable_set(:@@foo, 1)
diff --git a/version.h b/version.h
index 5eddeab130..d6e64475ab 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-04-12"
-#define RUBY_PATCHLEVEL 113
+#define RUBY_PATCHLEVEL 114
#define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 4
diff --git a/vm_method.c b/vm_method.c
index 1dbbdd511b..951ee4e6a8 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -752,7 +752,8 @@ rb_export_method(VALUE klass, ID name, rb_method_flag_t noex)
if (me->flag != noex) {
rb_vm_check_redefinition_opt_method(me, klass);
- if (klass == defined_class) {
+ if (klass == defined_class ||
+ RCLASS_ORIGIN(klass) == defined_class) {
me->flag = noex;
if (me->def->type == VM_METHOD_TYPE_REFINED) {
me->def->body.orig_me->flag = noex;