[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.113.4.1,1.113.4.2
Michael Hudson
mwh@users.sourceforge.net
Tue, 05 Mar 2002 07:37:21 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv15359
Modified Files:
Tag: release22-maint
test_descr.py
Log Message:
backport gvanrossum's checkin of
revision 1.115 of test_descr.py
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.
I haven't quite worked out how to port the fix yet, but the test cases
can go straight over.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.113.4.1
retrieving revision 1.113.4.2
diff -C2 -d -r1.113.4.1 -r1.113.4.2
*** test_descr.py 4 Jan 2002 12:28:43 -0000 1.113.4.1
--- test_descr.py 5 Mar 2002 15:37:18 -0000 1.113.4.2
***************
*** 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']