Skip to content

Commit

Permalink
Ensure we don't try to change the type of a type object.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Oct 23, 2011
1 parent 5ed5bc0 commit d7cec32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/6model/reprs/P6opaque.c
Expand Up @@ -842,6 +842,11 @@ static void change_type(PARROT_INTERP, PMC *obj, PMC *new_type) {
PMC *cur_mro, *new_mro;
INTVAL cur_mro_elems, new_mro_elems, mro_is_suffix;

/* Ensure we're not trying to change the type of a type object. */
if (PObj_flag_TEST(private0, obj))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Cannot change the type of a type object");

/* Ensure that the destination type REPR is P6opaque also. */
if (REPR(obj) != REPR(new_type))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
Expand Down

0 comments on commit d7cec32

Please sign in to comment.