From b16baa9272fbc9309614a625f7a1ad4876d6c839 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 8 Dec 2008 16:47:47 +0000 Subject: [PATCH] * eval.c (rb_make_exception): single argument to raise may be string compatible object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00c9d98b11..d357bb6f6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,6 +72,11 @@ Sat Dec 6 14:35:06 2008 NARUSE, Yui * pack.c (pack_unpack): ditto. +Fri Dec 5 22:56:24 2008 Yukihiro Matsumoto + + * eval.c (rb_make_exception): single argument to raise may be + string compatible object. + Fri Dec 5 21:45:45 2008 Tadayoshi Funaba * rational.c (nurat_{to_s,inspect}): performance improvement. diff --git a/eval.c b/eval.c index 636c225565..9c99711ce9 100644 --- a/eval.c +++ b/eval.c @@ -477,13 +477,13 @@ rb_make_exception(int argc, VALUE *argv) mesg = Qnil; switch (argc) { case 0: - mesg = Qnil; break; case 1: if (NIL_P(argv[0])) break; - if (TYPE(argv[0]) == T_STRING) { - mesg = rb_exc_new3(rb_eRuntimeError, argv[0]); + mesg = rb_check_string_type(argv[0]); + if (!NIL_P(mesg)) { + mesg = rb_exc_new3(rb_eRuntimeError, mesg); break; } n = 0;