Skip to content

Commit 0d8b17e

Browse files
committed
shape.c: Add a hack to fix variation accounting of T_CLASS and T_MODULE.
This would be fixed by using proper T_IMEMO instead of T_OBJECT to store class fields.
1 parent 1055d42 commit 0d8b17e

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

shape.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -825,14 +825,11 @@ shape_get_next(rb_shape_t *shape, VALUE obj, ID id, bool emit_warnings)
825825
#endif
826826

827827
VALUE klass;
828-
switch (BUILTIN_TYPE(obj)) {
829-
case T_CLASS:
830-
case T_MODULE:
831-
klass = rb_singleton_class(obj);
832-
break;
833-
default:
828+
if (RB_TYPE_P(obj, T_OBJECT) && FL_TEST_RAW(obj, ROBJECT_HIDDEN)) { // HACK
829+
klass = CLASS_OF(obj);
830+
}
831+
else {
834832
klass = rb_obj_class(obj);
835-
break;
836833
}
837834

838835
bool allow_new_shape = RCLASS_VARIATION_COUNT(klass) < SHAPE_MAX_VARIATIONS;

0 commit comments

Comments
 (0)