summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-10 05:42:07 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-10 05:42:07 (GMT)
commit40af889081938c1fea83cba0a9cbdb35e299119d (patch)
treeb82e6e114ba1710a0d4bb6fbdd23baf7c7a25dea /Lib/test/test_descr.py
parente05f65a0c6fb0b59fe72bcb8055eb74a3f63bff8 (diff)
downloadcpython-40af889081938c1fea83cba0a9cbdb35e299119d.zip
cpython-40af889081938c1fea83cba0a9cbdb35e299119d.tar.gz
cpython-40af889081938c1fea83cba0a9cbdb35e299119d.tar.bz2
Disallow class assignment completely unless both old and new are heap
types. This prevents nonsense like 2.__class__ = bool or True.__class__ = int.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py5
1 files changed, 5 insertions, 0 deletions
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 @@ def setclass():
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..."