Disallow class assignment completely unless both old and new are heap
types. This prevents nonsense like 2.__class__ = bool or
True.__class__ = int.
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 51fa0d9..1ce08b7 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -2478,6 +2478,11 @@
cant(C(), object)
cant(object(), list)
cant(list(), object)
+ class Int(int): __slots__ = []
+ cant(2, Int)
+ cant(Int(), int)
+ cant(True, int)
+ cant(2, bool)
def setdict():
if verbose: print "Testing __dict__ assignment..."