
Hello again. A lot of overflow tests fail in the testsuite, by expecting overflow using sys.maxint. for example this line, 196, in test_index.py: self.assertEqual(x[self.neg:self.pos], (-1, maxint)) At the moment, I am disabling these tests with if "64 bit" not in sys.version: So, two questions: Should we add something like sys.maxsize to keep these overflow tests valid? Also, some tests just kill the computer when given large values, that are expected to overflow. Sometimes it would be good to test for a 64 bit machine with virtually infinite ram. Is there a better way than the "64 bit" in sys.version test? Should we have something like sys.bits? Kristján

Kristján Valur Jónsson schrieb:
Hello again. A lot of overflow tests fail in the testsuite, by expecting overflow using sys.maxint. for example this line, 196, in test_index.py: self.assertEqual(x[self.neg:self.pos], (-1, maxint))
On my (virtual) win64-machine, which has less than 1GB, quite some tests fail with MemoryError. The tests pass on 64-bit linux machines, though.
At the moment, I am disabling these tests with if "64 bit" not in sys.version:
So, two questions: Should we add something like sys.maxsize to keep these overflow tests valid?
Also, some tests just kill the computer when given large values, that are expected to overflow. Sometimes it would be good to test for a 64 bit machine with virtually infinite ram. Is there a better way than the "64 bit" in sys.version test? Should we have something like sys.bits?
You can use 'struct.calcsize("P")' to find out the pointer size. Thomas

-----Original Message----- From: python-dev-bounces+kristjan=ccpgames.com@python.org [mailto:python-dev-bounces+kristjan=ccpgames.com@python.org] On Behalf Of Thomas Heller Sent: Thursday, May 03, 2007 17:04 To: python-dev@python.org Subject: Re: [Python-Dev] x64 and the testsuite
Kristján Valur Jónsson schrieb:
Hello again. A lot of overflow tests fail in the testsuite, by expecting overflow using sys.maxint. for example this line, 196, in test_index.py: self.assertEqual(x[self.neg:self.pos], (-1, maxint))
On my (virtual) win64-machine, which has less than 1GB, quite some tests fail with MemoryError. The tests pass on 64-bit linux machines, though. I haven't got memory error yet. Many tests allocate some 4GB, and the OS happily enters paging mode. They then succeed eventually. As for linux, many of the range overflow tests rely on sys.maxint. Presumably,
this is 1<<63 on those machines? If that is the case, I have two suggestions: a) Propagate the Windows idiom of sizeof(size_t) != sizeof(long) by keeping some sys.maxsize for list length, indices, etc. b) Elevate int to 64 bits on windows too! B is probably a huge change. Not only change PyIntObject but probably create some Py_int and so on. Ok, b) is not a real suggestion, then.
than the "64 bit" in sys.version test? Should we have something like sys.bits?
You can use 'struct.calcsize("P")' to find out the pointer size. Hm, I could do that I suppose. maxsize = (1L<<(struct.calcsize("P")*8-1))-1 minsize = maxsize-1
And use those in the testsuite... K

If that is the case, I have two suggestions: a) Propagate the Windows idiom of sizeof(size_t) != sizeof(long) by keeping some sys.maxsize for list length, indices, etc. b) Elevate int to 64 bits on windows too! B is probably a huge change. Not only change PyIntObject but probably create some Py_int and so on. Ok, b) is not a real suggestion, then.
Also, in Py3k, the int type will go away, along with this entire problem. Regards, Martin

Kristján Valur Jónsson wrote:
Hello again. A lot of overflow tests fail in the testsuite, by expecting overflow using sys.maxint. for example this line, 196, in test_index.py: self.assertEqual(x[self.neg:self.pos], (-1, maxint))
Those tests should be fixed to use test.test_support.MAX_Py_ssize_t instead of sys.maxint. Regards, Ziga
participants (5)
-
"Martin v. Löwis"
-
Armin Rigo
-
Kristján Valur Jónsson
-
Thomas Heller
-
Žiga Seilnacht