Skip to content

Commit d7cec32

Browse files
committed
Ensure we don't try to change the type of a type object.
1 parent 5ed5bc0 commit d7cec32

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/6model/reprs/P6opaque.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,11 @@ static void change_type(PARROT_INTERP, PMC *obj, PMC *new_type) {
842842
PMC *cur_mro, *new_mro;
843843
INTVAL cur_mro_elems, new_mro_elems, mro_is_suffix;
844844

845+
/* Ensure we're not trying to change the type of a type object. */
846+
if (PObj_flag_TEST(private0, obj))
847+
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
848+
"Cannot change the type of a type object");
849+
845850
/* Ensure that the destination type REPR is P6opaque also. */
846851
if (REPR(obj) != REPR(new_type))
847852
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,

0 commit comments

Comments
 (0)