[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.112,1.113
Guido van Rossum
gvanrossum@users.sourceforge.net
2001年12月13日 20:19:58 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv28932
Modified Files:
test_descr.py
Log Message:
(Merge into trunk.)
Fix for SF bug #492345. (I could've sworn I checked this in, but
apparently I didn't!)
This code:
class Classic:
pass
class New(Classic):
__metaclass__ = type
attempts to create a new-style class with only classic bases -- but it
doesn't work right. Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.112
retrieving revision 1.113
diff -C2 -d -r1.112 -r1.113
*** test_descr.py 2001年12月11日 04:37:34 1.112
--- test_descr.py 2001年12月14日 04:19:56 1.113
***************
*** 923,926 ****
--- 923,936 ----
vereq(m.all_method(), "M3 b")
+ class Classic:
+ pass
+ try:
+ class New(Classic):
+ __metaclass__ = type
+ except TypeError:
+ pass
+ else:
+ raise TestFailed, "new class with only classic bases - shouldn't be"
+
def diamond():
if verbose: print "Testing multiple inheritance special cases..."