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

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 01 Mar 2002 14:24:26 -0800


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

Modified Files:
	test_descr.py 
Log Message:
SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjects

Due to the bizarre definition of _PyLong_Copy(), creating an instance
of a subclass of long with a negative value could cause core dumps
later on.  Unfortunately it looks like the behavior of _PyLong_Copy()
is quite intentional, so the fix is more work than feels comfortable.

This fix is almost, but not quite, the code that Naofumi Honda added;
in addition, I added a test case.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.114
retrieving revision 1.115
diff -C2 -d -r1.114 -r1.115
*** test_descr.py	28 Dec 2001 21:39:03 -0000	1.114
--- test_descr.py	1 Mar 2002 22:24:24 -0000	1.115
***************
*** 1749,1752 ****
--- 1749,1756 ----
      verify((0 + a).__class__ is long)
  
+     # Check that negative clones don't segfault
+     a = longclone(-1)
+     vereq(a.__dict__, {})
+ 
      class precfloat(float):
          __slots__ = ['prec']