summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-05-15 12:14:53 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-05-15 16:06:52 +0200
commit60ffb714d251878753ebf66e68149311c728cac6 (patch)
treed9cb46a81af9313ad6faa6faa559fd1c4c7c2c66 /eval.c
parented632cd0bacc710b03809c903a978d3fa2cfedfe (diff)
Ensure shape_id is never used on T_IMEMO
It doesn't make sense to set ivars or anything shape related on a T_IMEMO. Co-Authored-By: John Hawthorn <john@hawthorn.email>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13347
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index f845bf98ae..739babf93d 100644
--- a/eval.c
+++ b/eval.c
@@ -529,10 +529,14 @@ exc_setup_message(const rb_execution_context_t *ec, VALUE mesg, VALUE *cause)
rb_exc_check_circular_cause(*cause);
#else
VALUE c = *cause;
- while (!NIL_P(c = rb_attr_get(c, id_cause))) {
+ while (!NIL_P(c)) {
if (c == mesg) {
rb_raise(rb_eArgError, "circular causes");
}
+ if (THROW_DATA_P(c)) {
+ break;
+ }
+ c = rb_attr_get(c, id_cause);
}
#endif
}