summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index b5f41e6fcd..e8dc008a53 100644
--- a/eval.c
+++ b/eval.c
@@ -467,9 +467,12 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
int status;
+ mesg = e;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
- RB_GC_GUARD(e) = rb_obj_as_string(e);
+ th->errinfo = Qnil;
+ e = rb_obj_as_string(mesg);
+ th->errinfo = mesg;
if (file && line) {
warn_printf("Exception `%s' at %s:%d - %s\n",
rb_obj_classname(th->errinfo),