summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-28 21:00:45 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-28 21:00:45 +0000
commitd785c36b885f2cee8353954b87cf5624d387a769 (patch)
tree07e43222d10fe2890179056a51a72ec5f49f9ed7 /eval.c
parent543a8b5e3d6869ab2312019afdd7ec277125b626 (diff)
merge revision(s) 57137: [Backport #13043]
eval.c: fix circular cause * eval.c (exc_setup_cause): always set cause of cause to get rid of circular references. [ruby-core:78688] [Bug #13043] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@57229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 fbd28565ed..43d1948f2f 100644
--- a/eval.c
+++ b/eval.c
@@ -466,8 +466,11 @@ exc_setup_cause(VALUE exc, VALUE cause)
}
}
#endif
- if (!NIL_P(cause) && cause != exc) {
+ if (!NIL_P(cause) && cause != exc && BUILTIN_TYPE(cause) != T_NODE) {
rb_ivar_set(exc, id_cause, cause);
+ if (!rb_ivar_defined(cause, id_cause)) {
+ rb_ivar_set(cause, id_cause, Qnil);
+ }
}
return exc;
}