Allow assignments to instance.__dict__ and instance.__class__.  The
former lets you give an instance a set of new instance vars.  The
latter lets you give it a new class.  Both are typechecked and
disallowed in restricted mode.

For classes, the check for read-only special attributes is tightened
so that only assignments to __dict__, __bases__, __name__,
__getattr__, __setattr__, and __delattr__ (these could be made to work
as well, but I don't know if that's useful -- let's see first whether
mucking with instances will help).
1 file changed