summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-18 06:19:36 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-18 06:19:36 (GMT)
commitde63d714e920f97265f9e4c4d17c363ca55e69c5 (patch)
tree2068ee325a6799b487a1063732130583a48165f1
parent4a71766957b39c9a487221d832e92690cd138cac (diff)
merge revision(s) 17396:
* marshal.c (w_object, marshal_dump, r_object0, marshal_load): search public methods only. [ruby-core:17283] * object.c (convert_type): ditto. * lib/singleton.rb (Singleton#_dump): conversion method should be public. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--lib/singleton.rb3
-rw-r--r--marshal.c22
-rw-r--r--object.c2
-rw-r--r--version.h2
5 files changed, 24 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 5011c72..8514205 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Jun 18 15:17:30 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
+ public methods only. [ruby-core:17283]
+
+ * object.c (convert_type): ditto.
+
+ * lib/singleton.rb (Singleton#_dump): conversion method should be
+ public.
+
Wed Jun 18 13:19:55 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
* file.c: fixes to compile on mswin32. Patch from U. Nakamura
diff --git a/lib/singleton.rb b/lib/singleton.rb
index 0ab8517..31fb950 100644
--- a/lib/singleton.rb
+++ b/lib/singleton.rb
@@ -70,8 +70,7 @@ module Singleton
def dup
raise TypeError, "can't dup instance of singleton #{self.class}"
end
-
- private
+
# default marshalling strategy
def _dump(depth=-1)
''
diff --git a/marshal.c b/marshal.c
index 494bfb7..8fad44c 100644
--- a/marshal.c
+++ b/marshal.c
@@ -511,7 +511,7 @@ w_object(obj, arg, limit)
if (OBJ_TAINTED(obj)) arg->taint = Qtrue;
st_add_direct(arg->data, obj, arg->data->num_entries);
- if (rb_obj_respond_to(obj, s_mdump, Qtrue)) {
+ if (rb_respond_to(obj, s_mdump)) {
volatile VALUE v;
v = rb_funcall(obj, s_mdump, 0, 0);
@@ -521,7 +521,7 @@ w_object(obj, arg, limit)
if (ivtbl) w_ivar(0, &c_arg);
return;
}
- if (rb_obj_respond_to(obj, s_dump, Qtrue)) {
+ if (rb_respond_to(obj, s_dump)) {
VALUE v;
v = rb_funcall(obj, s_dump, 1, INT2NUM(limit));
@@ -664,7 +664,7 @@ w_object(obj, arg, limit)
{
VALUE v;
- if (!rb_obj_respond_to(obj, s_dump_data, Qtrue)) {
+ if (!rb_respond_to(obj, s_dump_data)) {
rb_raise(rb_eTypeError,
"no marshal_dump is defined for class %s",
rb_obj_classname(obj));
@@ -765,12 +765,12 @@ marshal_dump(argc, argv)
arg.str = rb_str_buf_new(0);
RBASIC(arg.str)->klass = 0;
if (!NIL_P(port)) {
- if (!rb_obj_respond_to(port, s_write, Qtrue)) {
+ if (!rb_respond_to(port, s_write)) {
type_error:
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.dest = port;
- if (rb_obj_respond_to(port, s_binmode, Qtrue)) {
+ if (rb_respond_to(port, s_binmode)) {
rb_funcall2(port, s_binmode, 0, 0);
reentrant_check(arg.str, s_dump_data);
}
@@ -1248,7 +1248,7 @@ r_object0(arg, proc, ivp, extmod)
VALUE klass = path2class(r_unique(arg));
VALUE data;
- if (!rb_obj_respond_to(klass, s_load, Qtrue)) {
+ if (!rb_respond_to(klass, s_load)) {
rb_raise(rb_eTypeError, "class %s needs to have method `_load'",
rb_class2name(klass));
}
@@ -1275,7 +1275,7 @@ r_object0(arg, proc, ivp, extmod)
rb_extend_object(v, m);
}
}
- if (!rb_obj_respond_to(v, s_mload, Qtrue)) {
+ if (!rb_respond_to(v, s_mload)) {
rb_raise(rb_eTypeError, "instance of %s needs to have method `marshal_load'",
rb_class2name(klass));
}
@@ -1302,7 +1302,7 @@ r_object0(arg, proc, ivp, extmod)
case TYPE_DATA:
{
VALUE klass = path2class(r_unique(arg));
- if (rb_obj_respond_to(klass, s_alloc, Qtrue)) {
+ if (rb_respond_to(klass, s_alloc)) {
static int warn = Qtrue;
if (warn) {
rb_warn("define `allocate' instead of `_alloc'");
@@ -1318,7 +1318,7 @@ r_object0(arg, proc, ivp, extmod)
rb_raise(rb_eArgError, "dump format error");
}
r_entry(v, arg);
- if (!rb_obj_respond_to(v, s_load_data, Qtrue)) {
+ if (!rb_respond_to(v, s_load_data)) {
rb_raise(rb_eTypeError,
"class %s needs to have instance method `_load_data'",
rb_class2name(klass));
@@ -1423,8 +1423,8 @@ marshal_load(argc, argv)
arg.taint = OBJ_TAINTED(port); /* original taintedness */
port = v;
}
- else if (rb_obj_respond_to(port, s_getc, Qtrue) && rb_obj_respond_to(port, s_read, Qtrue)) {
- if (rb_obj_respond_to(port, s_binmode, Qtrue)) {
+ else if (rb_respond_to(port, s_getc) && rb_respond_to(port, s_read)) {
+ if (rb_respond_to(port, s_binmode)) {
rb_funcall2(port, s_binmode, 0, 0);
}
arg.taint = Qtrue;
diff --git a/object.c b/object.c
index cd100e4..825056d 100644
--- a/object.c
+++ b/object.c
@@ -2055,7 +2055,7 @@ convert_type(val, tname, method, raise)
ID m;
m = rb_intern(method);
- if (!rb_obj_respond_to(val, m, Qtrue)) {
+ if (!rb_respond_to(val, m)) {
if (raise) {
rb_raise(rb_eTypeError, "can't convert %s into %s",
NIL_P(val) ? "nil" :
diff --git a/version.h b/version.h
index 2b0af78..ac4f71d 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2008-06-18"
#define RUBY_VERSION_CODE 185
#define RUBY_RELEASE_CODE 20080618
-#define RUBY_PATCHLEVEL 225
+#define RUBY_PATCHLEVEL 226
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8