summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-28 04:23:21 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-28 04:23:21 +0000
commit9f7e5d1d9bf02881f9a7dbc0673d8f9e972f5368 (patch)
treea7c2636cf1a250d64a2ebfb03941920df5d016d2
parent65720ff11a9b64205291f44a28ccd7854976aaf4 (diff)
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--marshal.c27
-rw-r--r--object.c2
-rw-r--r--version.h6
4 files changed, 25 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 02a4bff..82da5cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed May 28 12:52:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
+ private methods too. [ruby-dev:34671]
+
+ * object.c (convert_type): ditto.
+
Tue May 27 20:19:22 2008 Akinori MUSHA <knu@iDaemons.org>
* array.c (rb_ary_slice_bang): Return an empty array instead of
diff --git a/marshal.c b/marshal.c
index bae313d..39758d8 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_respond_to(obj, s_mdump)) {
+ if (rb_obj_respond_to(obj, s_mdump, Qtrue)) {
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_respond_to(obj, s_dump)) {
+ if (rb_obj_respond_to(obj, s_dump, Qtrue)) {
VALUE v;
v = rb_funcall(obj, s_dump, 1, INT2NUM(limit));
@@ -664,7 +664,7 @@ w_object(obj, arg, limit)
{
VALUE v;
- if (!rb_respond_to(obj, s_dump_data)) {
+ if (!rb_obj_respond_to(obj, s_dump_data, Qtrue)) {
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_respond_to(port, s_write)) {
+ if (!rb_obj_respond_to(port, s_write, Qtrue)) {
type_error:
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.dest = port;
- if (rb_respond_to(port, s_binmode)) {
+ if (rb_obj_respond_to(port, s_binmode, Qtrue)) {
rb_funcall2(port, s_binmode, 0, 0);
reentrant_check(arg.str, s_dump_data);
}
@@ -1245,7 +1245,7 @@ r_object0(arg, proc, ivp, extmod)
VALUE klass = path2class(r_unique(arg));
VALUE data;
- if (!rb_respond_to(klass, s_load)) {
+ if (!rb_obj_respond_to(klass, s_load, Qtrue)) {
rb_raise(rb_eTypeError, "class %s needs to have method `_load'",
rb_class2name(klass));
}
@@ -1272,7 +1272,7 @@ r_object0(arg, proc, ivp, extmod)
rb_extend_object(v, m);
}
}
- if (!rb_respond_to(v, s_mload)) {
+ if (!rb_obj_respond_to(v, s_mload, Qtrue)) {
rb_raise(rb_eTypeError, "instance of %s needs to have method `marshal_load'",
rb_class2name(klass));
}
@@ -1299,7 +1299,7 @@ r_object0(arg, proc, ivp, extmod)
case TYPE_DATA:
{
VALUE klass = path2class(r_unique(arg));
- if (rb_respond_to(klass, s_alloc)) {
+ if (rb_obj_respond_to(klass, s_alloc, Qtrue)) {
static int warn = Qtrue;
if (warn) {
rb_warn("define `allocate' instead of `_alloc'");
@@ -1315,7 +1315,7 @@ r_object0(arg, proc, ivp, extmod)
rb_raise(rb_eArgError, "dump format error");
}
r_entry(v, arg);
- if (!rb_respond_to(v, s_load_data)) {
+ if (!rb_obj_respond_to(v, s_load_data, Qtrue)) {
rb_raise(rb_eTypeError,
"class %s needs to have instance method `_load_data'",
rb_class2name(klass));
@@ -1415,12 +1415,13 @@ marshal_load(argc, argv)
struct load_arg arg;
rb_scan_args(argc, argv, "11", &port, &proc);
- if (rb_respond_to(port, rb_intern("to_str"))) {
+ v = rb_check_string_type(port);
+ if (!NIL_P(v)) {
arg.taint = OBJ_TAINTED(port); /* original taintedness */
- StringValue(port); /* possible conversion */
+ port = v;
}
- else if (rb_respond_to(port, s_getc) && rb_respond_to(port, s_read)) {
- if (rb_respond_to(port, s_binmode)) {
+ 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)) {
rb_funcall2(port, s_binmode, 0, 0);
}
arg.taint = Qtrue;
diff --git a/object.c b/object.c
index 2777843..fcc30bd 100644
--- a/object.c
+++ b/object.c
@@ -2193,7 +2193,7 @@ convert_type(val, tname, method, raise)
ID m;
m = rb_intern(method);
- if (!rb_respond_to(val, m)) {
+ if (!rb_obj_respond_to(val, m, Qtrue)) {
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 39caaad..4ebbaef 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2008-05-27"
+#define RUBY_RELEASE_DATE "2008-05-28"
#define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20080527
+#define RUBY_RELEASE_CODE 20080528
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 27
+#define RUBY_RELEASE_DAY 28
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];