Skip to content

Commit

Permalink
* eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Apr 3, 2003
1 parent 153f513 commit c94187b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ Wed Apr 02 15:11:23 2003 Nobuyoshi Nakada <[email protected]>
* README.EXT, README.EXT.ja (3.3): clarified -1 as free for
Data_Wrap_Struct(). [ruby-dev:19881]

Mon Mar 31 11:11:36 2003 Yukihiro Matsumoto <[email protected]>

* eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.

Mon Mar 31 10:50:48 2003 Yukihiro Matsumoto <[email protected]>

* eval.c (rb_f_missing):

* hash.c (env_reject_bang): untaint key string.

* hash.c (env_delete_m): execute block only if deleting key does
Expand Down
3 changes: 2 additions & 1 deletion array.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,8 @@ Init_Array()
rb_define_alloc_func(rb_cArray, ary_alloc);
rb_define_singleton_method(rb_cArray, "[]", rb_ary_s_create, -1);
rb_define_method(rb_cArray, "initialize", rb_ary_initialize, -1);
rb_define_method(rb_cArray, "copy_object", rb_ary_replace, 1);

rb_define_method(rb_cArray, "to_s", rb_ary_to_s, 0);
rb_define_method(rb_cArray, "inspect", rb_ary_inspect, 0);
rb_define_method(rb_cArray, "to_a", rb_ary_to_a, 0);
Expand Down Expand Up @@ -1948,7 +1950,6 @@ Init_Array()
rb_define_method(rb_cArray, "rindex", rb_ary_rindex, 1);
rb_define_method(rb_cArray, "indexes", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "indices", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "copy_object", rb_ary_replace, 1);
rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0);
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse_bang, 0);
Expand Down
8 changes: 4 additions & 4 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -4509,11 +4509,11 @@ rb_f_missing(argc, argv, obj)
case T_FALSE:
desc = "false";
break;
case T_OBJECT:
d = rb_any_to_s(obj);
break;
default:
d = rb_inspect(obj);
if (rb_respond_to(obj, rb_intern("inspect")))
d = rb_inspect(obj);
else
d = rb_any_to_s(obj);
break;
}
if (d) {
Expand Down
2 changes: 1 addition & 1 deletion ext/tk/lib/tk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ def inspect
def ==(other)
case other
when TkVariable
self.equal(self)
self.equal(other)
when String
self.to_s == other
when Integer
Expand Down
1 change: 0 additions & 1 deletion hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,6 @@ Init_Hash()
rb_define_alloc_func(rb_cHash, hash_alloc);
rb_define_singleton_method(rb_cHash, "[]", rb_hash_s_create, -1);
rb_define_method(rb_cHash,"initialize", rb_hash_initialize, -1);

rb_define_method(rb_cHash,"copy_object", rb_hash_replace, 1);
rb_define_method(rb_cHash,"rehash", rb_hash_rehash, 0);

Expand Down
13 changes: 12 additions & 1 deletion io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2886,6 +2886,17 @@ rb_io_s_new(argc, argv, klass)
return rb_class_new_instance(argc, argv, klass);
}

static VALUE
rb_io_s_for_fd(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
VALUE io = rb_obj_alloc(klass);
rb_io_initialize(argc, argv, io);
return io;
}

static int binmode = 0;

static VALUE
Expand Down Expand Up @@ -3944,7 +3955,7 @@ Init_IO()
rb_define_singleton_method(rb_cIO, "new", rb_io_s_new, -1);
rb_define_singleton_method(rb_cIO, "open", rb_io_s_open, -1);
rb_define_singleton_method(rb_cIO, "sysopen", rb_io_s_sysopen, -1);
rb_define_singleton_method(rb_cIO, "for_fd", rb_class_new_instance, -1);
rb_define_singleton_method(rb_cIO, "for_fd", rb_io_s_for_fd, -1);
rb_define_singleton_method(rb_cIO, "popen", rb_io_s_popen, -1);
rb_define_singleton_method(rb_cIO, "foreach", rb_io_s_foreach, -1);
rb_define_singleton_method(rb_cIO, "readlines", rb_io_s_readlines, -1);
Expand Down
2 changes: 1 addition & 1 deletion numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,8 @@ Init_Numeric()
rb_cNumeric = rb_define_class("Numeric", rb_cObject);

rb_include_module(rb_cNumeric, rb_mComparable);
rb_define_method(rb_cNumeric, "coerce", num_coerce, 1);
rb_define_method(rb_cNumeric, "copy_object", num_copy_object, 1);
rb_define_method(rb_cNumeric, "coerce", num_coerce, 1);

rb_define_method(rb_cNumeric, "+@", num_uplus, 0);
rb_define_method(rb_cNumeric, "-@", num_uminus, 0);
Expand Down

0 comments on commit c94187b

Please sign in to comment.