8000 merge revision(s) 16654: · documenting-ruby/ruby@ef977df · GitHub
[go: up one dir, main page]

Skip to content

Commit ef977df

Browse files
committed
merge revision(s) 16654:
* marshal.c (w_object, marshal_dump, r_object0, marshal_load): search private methods too. [ruby-dev:34671] * object.c (convert_type): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent b25c0d7 commit ef977df

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Sun Jun 15 23:27:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
4+
private methods too. [ruby-dev:34671]
5+
6+
* object.c (convert_type): ditto.
7+
18
Sun Jun 15 23:26:24 2008 Akinori MUSHA <knu@iDaemons.org>
29

310
* numeric.c (flo_divmod): Revert the behavior change; do not

marshal.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ w_object(obj, arg, limit)
511511
if (OBJ_TAINTED(obj)) arg->taint = Qtrue;
512512

513513
st_add_direct(arg->data, obj, arg->data->num_entries);
514-
if (rb_respond_to(obj, s_mdump)) {
514+
if (rb_obj_respond_to(obj, s_mdump, Qtrue)) {
515515
volatile VALUE v;
516516

517517
v = rb_funcall(obj, s_mdump, 0, 0);
@@ -521,7 +521,7 @@ w_object(obj, arg, limit)
521521
if (ivtbl) w_ivar(0, &c_arg);
522522
return;
523523
}
524-
if (rb_respond_to(obj, s_dump)) {
524+
if (rb_obj_respond_to(obj, s_dump, Qtrue)) {
525525
VALUE v;
526526

527527
v = rb_funcall(obj, s_dump, 1, INT2NUM(limit));
@@ -664,7 +664,7 @@ w_object(obj, arg, limit)
664664
{
665665
VALUE v;
666666

667-
if (!rb_respond_to(obj, s_dump_data)) {
667+
if (!rb_obj_respond_to(obj, s_dump_data, Qtrue)) {
668668
rb_raise(rb_eTypeError,
669669
"no marshal_dump is defined for class %s",
670670
rb_obj_classname(obj));
@@ -765,12 +765,12 @@ marshal_dump(argc, argv)
765765
arg.str = rb_str_buf_new(0);
766766
RBASIC(arg.str)->klass = 0;
767767
if (!NIL_P(port)) {
768-
if (!rb_respond_to(port, s_write)) {
768+
if (!rb_obj_respond_to(port, s_write, Qtrue)) {
769769
type_error:
770770
rb_raise(rb_eTypeError, "instance of IO needed");
771771
}
772772
arg.dest = port;
773-
if (rb_respond_to(port, s_binmode)) {
773+
if (rb_obj_respond_to(port, s_binmode, Qtrue)) {
774774
rb_funcall2(port, s_binmode, 0, 0);
775775
reentrant_check(arg.str, s_dump_data);
776776
}
@@ -1248,7 +1248,7 @@ r_object0(arg, proc, ivp, extmod)
12481248
VALUE klass = path2class(r_unique(arg));
12491249
VALUE data;
12501250

1251-
if (!rb_respond_to(klass, s_load)) {
1251+
if (!rb_obj_respond_to(klass, s_load, Qtrue)) {
12521252
rb_raise(rb_eTypeError, "class %s needs to have method `_load'",
12531253
rb_class2name(klass));
12541254
}
@@ -1275,7 +1275,7 @@ r_object0(arg, proc, ivp, extmod)
12751275
rb_extend_object(v, m);
12761276
}
12771277
}
1278-
if (!rb_respond_to(v, s_mload)) {
1278+
if (!rb_obj_respond_to(v, s_mload, Qtrue)) {
12791279
rb_raise(rb_eTypeError, "instance of %s needs to have method `marshal_load'",
12801280
rb_class2name(klass));
12811281
}
@@ -1302,7 +1302,7 @@ r_object0(arg, proc, ivp, extmod)
13021302
case TYPE_DATA:
13031303
{
13041304
VALUE klass = path2class(r_unique(arg));
1305-
if (rb_respond_to(klass, s_alloc)) {
1305+
if (rb_obj_respond_to(klass, s_alloc, Qtrue)) {
13061306
static int warn = Qtrue;
13071307
if (warn) {
13081308
rb_warn("define `allocate' instead of `_alloc'");
@@ -1318,7 +1318,7 @@ r_object0(arg, proc, ivp, extmod)
13181318
rb_raise(rb_eArgError, "dump format error");
13191319
}
13201320
r_entry(v, arg);
1321-
if (!rb_respond_to(v, s_load_data)) {
1321+
if (!rb_obj_respond_to(v, s_load_data, Qtrue)) {
13221322
rb_raise(rb_eTypeError,
13231323
"class %s needs to have instance method `_load_data'",
13241324
rb_class2name(klass));
@@ -1418,12 +1418,13 @@ marshal_load(argc, argv)
14181418
struct load_arg arg;
14191419

14201420
rb_scan_args(argc, argv, "11", &port, &proc);
1421-
if (rb_respond_to(port, rb_intern("to_str"))) {
1421+
v = rb_check_string_type(port);
1422+
if (!NIL_P(v)) {
14221423
arg.taint = OBJ_TAINTED(port); /* original taintedness */
1423-
StringValue(port); /* possible conversion */
1424+
port = v;
14241425
}
1425-
else if (rb_respond_to(port, s_getc) && rb_respond_to(port, s_read)) {
1426-
if (rb_respond_to(port, s_binmode)) {
1426+
else if (rb_obj_respond_to(port, s_getc, Qtrue) && rb_obj_respond_to(port, s_read, Qtrue)) {
1427+
if (rb_obj_respond_to(port, s_binmode, Qtrue)) {
14271428
rb_funcall2(port, s_binmode, 0, 0);
14281429
}
14291430
arg.taint = Qtrue;

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ convert_type(val, tname, method, raise)
20552055
ID m;
20562056

20572057
m = rb_intern(method);
2058-
if (!rb_respond_to(val, m)) {
2058+
if (!rb_obj_respond_to(val, m, Qtrue)) {
20592059
if (raise) {
20602060
rb_raise(rb_eTypeError, "can't convert %s into %s",
20612061
NIL_P(val) ? "nil" :

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2008-06-15"
33
#define RUBY_VERSION_CODE 185
44
#define RUBY_RELEASE_CODE 20080615
5-
#define RUBY_PATCHLEVEL 218
5+
#define RUBY_PATCHLEVEL 219
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)
0