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>
This commit is contained in:
Jean Boussier 2025-05-15 12:14:53 +02:00
parent ed632cd0ba
commit 60ffb714d2
Notes: git 2025-05-15 14:07:06 +00:00
5 changed files with 23 additions and 6 deletions

6
eval.c
View file

@ -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
}