[Python-checkins] python/dist/src/Lib/test test_descr.py,1.152,1.153

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2002年8月09日 22:42:09 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv19902
Modified Files:
	test_descr.py 
Log Message:
Disallow class assignment completely unless both old and new are heap
types. This prevents nonsense like 2.__class__ = bool or
True.__class__ = int.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.152
retrieving revision 1.153
diff -C2 -d -r1.152 -r1.153
*** test_descr.py	9 Aug 2002 16:11:37 -0000	1.152
--- test_descr.py	10 Aug 2002 05:42:07 -0000	1.153
***************
*** 2479,2482 ****
--- 2479,2487 ----
 cant(object(), list)
 cant(list(), object)
+ class Int(int): __slots__ = []
+ cant(2, Int)
+ cant(Int(), int)
+ cant(True, int)
+ cant(2, bool)
 
 def setdict():

AltStyle によって変換されたページ (->オリジナル) /