summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index ad7f1a5b75..fbe17d034b 100644
--- a/eval.c
+++ b/eval.c
@@ -493,13 +493,15 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
if (file && !NIL_P(mesg)) {
VALUE at;
if (sysstack_error_p(mesg)) {
- at = rb_vm_backtrace_object();
- if (mesg == sysstack_error) {
- VALUE ruby_vm_sysstack_error_copy(void);
- mesg = ruby_vm_sysstack_error_copy();
+ if (NIL_P(rb_attr_get(mesg, idBt))) {
+ at = rb_vm_backtrace_object();
+ if (mesg == sysstack_error) {
+ VALUE ruby_vm_sysstack_error_copy(void);
+ mesg = ruby_vm_sysstack_error_copy();
+ }
+ rb_ivar_set(mesg, idBt, at);
+ rb_ivar_set(mesg, idBt_locations, at);
}
- rb_ivar_set(mesg, idBt, at);
- rb_ivar_set(mesg, idBt_locations, at);
}
else if (NIL_P(get_backtrace(mesg))) {
at = rb_vm_backtrace_object();