ruby-changes:14264
From: shyouhei <ko1@a...>
Date: Mon, 14 Dec 2009 12:19:39 +0900 (JST)
Subject: [ruby-changes:14264] Ruby:r26089 (ruby_1_8_7): merge revision(s) 25921:
shyouhei 2009-12-14 12:19:26 +0900 (Mon, 14 Dec 2009) New Revision: 26089 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26089 Log: merge revision(s) 25921: * ext/digest/digest.c (rb_digest_instance_method_unimpl): Do not call rb_inspect() on an object that does not implement necessary methods; reported by NaHi. Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/ext/digest/digest.c branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ext/digest/digest.c =================================================================== --- ruby_1_8_7/ext/digest/digest.c (revision 26088) +++ ruby_1_8_7/ext/digest/digest.c (revision 26089) @@ -83,6 +83,15 @@ * object to calculate message digest values. */ +static void +rb_digest_instance_method_unimpl(VALUE self, const char *method) +{ + VALUE klass = rb_obj_class(self); + + rb_raise(rb_eRuntimeError, "%s does not implement %s()", + rb_obj_classname(self), method); +} + /* * call-seq: * digest_obj.update(string) -> digest_obj @@ -97,7 +106,7 @@ static VALUE rb_digest_instance_update(VALUE self, VALUE str) { - rb_raise(rb_eRuntimeError, "%s does not implement update()", RSTRING_PTR(rb_inspect(self))); + rb_digest_instance_method_unimpl(self, "update"); } /* @@ -115,7 +124,7 @@ static VALUE rb_digest_instance_finish(VALUE self) { - rb_raise(rb_eRuntimeError, "%s does not implement finish()", RSTRING_PTR(rb_inspect(self))); + rb_digest_instance_method_unimpl(self, "finish"); } /* @@ -129,7 +138,7 @@ static VALUE rb_digest_instance_reset(VALUE self) { - rb_raise(rb_eRuntimeError, "%s does not implement reset()", RSTRING_PTR(rb_inspect(self))); + rb_digest_instance_method_unimpl(self, "reset"); } /* @@ -358,7 +367,7 @@ static VALUE rb_digest_instance_block_length(VALUE self) { - rb_raise(rb_eRuntimeError, "%s does not implement block_length()", RSTRING_PTR(rb_inspect(self))); + rb_digest_instance_method_unimpl(self, "block_length"); } /* Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 26088) +++ ruby_1_8_7/ChangeLog (revision 26089) @@ -1,3 +1,9 @@ +Mon Dec 14 12:06:39 2009 Akinori MUSHA <knu@i...> + + * ext/digest/digest.c (rb_digest_instance_method_unimpl): Do not + call rb_inspect() on an object that does not implement necessary + methods; reported by NaHi. + Mon Dec 14 11:47:31 2009 Nobuyoshi Nakada <nobu@r...> * eval.c (rb_method_missing): adjusted format and argument number. Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 26088) +++ ruby_1_8_7/version.h (revision 26089) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2009-12-14" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20091214 -#define RUBY_PATCHLEVEL 233 +#define RUBY_PATCHLEVEL 234 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/