[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.113.4.8,1.113.4.9

Guido van Rossum gvanrossum@users.sourceforge.net
Sun, 17 Mar 2002 19:05:38 -0800


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

Modified Files:
      Tag: release22-maint
	test_descr.py 
Log Message:
Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfault

The proper fix is not quite what was submitted; it's really better to
take the class of the object passed rather than calling PyMethod_New
with NULL pointer args, because that can then cause other core dumps
later.

I also added a testcase for the fix to classmethods() in test_descr.py.

I'll apply this to 2.3 too.



Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.113.4.8
retrieving revision 1.113.4.9
diff -C2 -d -r1.113.4.8 -r1.113.4.9
*** test_descr.py	17 Mar 2002 19:31:28 -0000	1.113.4.8
--- test_descr.py	18 Mar 2002 03:05:36 -0000	1.113.4.9
***************
*** 1209,1212 ****
--- 1209,1217 ----
      vereq(d.foo(1), (d, 1))
      vereq(D.foo(d, 1), (d, 1))
+     # Test for a specific crash (SF bug 528132)
+     def f(cls, arg): return (cls, arg)
+     ff = classmethod(f)
+     vereq(ff.__get__(0, int)(42), (int, 42))
+     vereq(ff.__get__(0)(42), (int, 42))
  
  def staticmethods():