summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-26 04:26:23 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-26 04:26:23 (GMT)
commit651b394a12fba26b9c64676978f9b2b3205c0b14 (patch)
tree6353ccdb2de273435052eac462c793910bedf429 /eval.c
parent9a4185de2581fc826d3c4687e210c9264e2dae5b (diff)
eval.c: preserve errinfo
* eval.c (setup_exception): preserve errinfo across calling #to_s method on the exception. [ruby-core:61091] [Bug #9568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 6102cfd..a70a7a9 100644
--- a/eval.c
+++ b/eval.c
@@ -511,9 +511,12 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
int status;
+ mesg = e;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
+ th->errinfo = Qnil;
e = rb_obj_as_string(e);
+ th->errinfo = mesg;
if (file && line) {
warn_printf("Exception `%s' at %s:%d - %"PRIsVALUE"\n",
rb_obj_classname(th->errinfo), file, line, e);