[Python-checkins] python/dist/src/Lib/test test_descr.py,1.134,1.135

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 24 May 2002 14:40:12 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv4146

Modified Files:
	test_descr.py 
Log Message:
Fix for SF bug 551412.  When _PyType_Lookup() is called on a type
whose tp_mro hasn't been initialized, it would dump core.  Fix this by
checking for NULL and calling PyType_Ready().  Will fix this in 2.2.1
too.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.134
retrieving revision 1.135
diff -C2 -d -r1.134 -r1.135
*** test_descr.py	13 May 2002 18:29:46 -0000	1.134
--- test_descr.py	24 May 2002 21:40:08 -0000	1.135
***************
*** 3020,3024 ****
--- 3020,3040 ----
          raise TestFailed, "string subclass allowed as exception"
  
+ def do_this_first():
+     if verbose:
+         print "Testing SF bug 551412 ..."
+     # This dumps core when SF bug 551412 isn't fixed --
+     # but only when test_descr.py is run separately.
+     # (That can't be helped -- as soon as PyType_Ready()
+     # is called for PyLong_Type, the bug is gone.)
+     class UserLong(object):
+         def __pow__(self, *args):
+             pass
+     try:
+         pow(0L, UserLong(), 0L)
+     except:
+         pass
+ 
  def test_main():
+     do_this_first()
      class_docstrings()
      lists()