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

Skip to content

Commit de63d71

Browse files
committed
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
1 parent 4a71766 commit de63d71

File tree

5 files changed

+24
-15
lines changed

5 files changed

+24
-15
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Wed Jun 18 15:17:30 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
4+
public methods only. [ruby-core:17283]
5+
6+
* object.c (convert_type): ditto.
7+
8+
* lib/singleton.rb (Singleton#_dump): conversion method should be
9+
public.
10+
111
Wed Jun 18 13:19:55 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
212

313
* file.c: fixes to compile on mswin32. Patch from U. Nakamura

lib/singleton.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ def clone
7070
def dup
7171
raise TypeError, "can't dup instance of singleton #{self.class}"
7272
end
73-
74-
private
73+
7574
# default marshalling strategy
7675
def _dump(depth=-1)
7776
''

marshal.c

Lines changed: 11 additions & 11 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_obj_respond_to(obj, s_mdump, Qtrue)) {
514+
if (rb_respond_to(obj, s_mdump)) {
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_obj_respond_to(obj, s_dump, Qtrue)) {
524+
if (rb_respond_to(obj, s_dump)) {
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_obj_respond_to(obj, s_dump_data, Qtrue)) {
667+
if (!rb_respond_to(obj, s_dump_data)) {
668668
rb_raise(rb_eTypeError,
669669
"no marshal_dump is defined for class %s",
670670
rb_obj_classname(obj));
@@ -765,12 +765,12 @ 8000 @ 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_obj_respond_to(port, s_write, Qtrue)) {
768+
if (!rb_respond_to(port, s_write)) {
769769
type_error:
770770
rb_raise(rb_eTypeError, "instance of IO needed");
771771
}
772772
arg.dest = port;
773-
if (rb_obj_respond_to(port, s_binmode, Qtrue)) {
773+
if (rb_respond_to(port, s_binmode)) {
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_obj_respond_to(klass, s_load, Qtrue)) {
1251+
if (!rb_respond_to(klass, s_load)) {
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_obj_respond_to(v, s_mload, Qtrue)) {
1278+
if (!rb_respond_to(v, s_mload)) {
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_obj_respond_to(klass, s_alloc, Qtrue)) {
1305+
if (rb_respond_to(klass, s_alloc)) {
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_obj_respond_to(v, s_load_data, Qtrue)) {
1321+
if (!rb_respond_to(v, s_load_data)) {
13221322
rb_raise(rb_eTypeError,
13231323
"class %s needs to have instance method `_load_data'",
13241324
rb_class2name(klass));
@@ -1423,8 +1423,8 @@ marshal_load(argc, argv)
14231423
arg.taint = OBJ_TAINTED(port); /* original taintedness */
14241424
port = v;
14251425
}
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)) {
1426+
else if (rb_respond_to(port, s_getc) && rb_respond_to(port, s_read)) {
1427+
if (rb_respond_to(port, s_binmode)) {
14281428
rb_funcall2(port, s_binmode, 0, 0);
14291429
}
14301430
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_obj_respond_to(val, m, Qtrue)) {
2058+
if (!rb_respond_to(val, m)) {
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-18"
33
#define RUBY_VERSION_CODE 185
44
#define RUBY_RELEASE_CODE 20080618
5-
#define RUBY_PATCHLEVEL 225
5+
#define RUBY_PATCHLEVEL 226
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)
0