This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_b1.py, disabling of list test
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: loewis, tzot
Priority: normal Keywords:

Created on 2002-09-13 18:54 by tzot, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (4)
msg12396 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2002-09-13 18:54
Guido disabled the list(xrange(sys.maxint / 4)) test
for 64-bit machines because PySequence_Length returns
an int and not ssize_t.

The test needs not be disabled; for the time being, it
should be
list(xrange(min(sys.maxint / 4, 0x1fffffff)))

There is another flaw, btw.
I ran the test on a 512MB RAM 64bit machine, and it passed.
However, when I ran it on a 16GB RAM 64bit machine, it
raised TestFailed incorrectly(!), because the statement
did not produce a MemoryError...  I think this is
probably the only occasion the 'else' part was ever
evaluated (but ICBW :) 

I did not supply a patch, because I didn't want to mess
with Guido's comments.  

<HUMOUR>
Perhaps the test should be just:
try:
    list(xrange(min(sys.maxint / 4, 0x1fffffff)
except MemoryError:
    pass
else:
    print "I wish this passed in my home machine too..."
</HUMOUR>
msg12397 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2002-09-13 18:58
Logged In: YES 
user_id=539787

I did indent the humourous code above, but the indentation
got lost after posting.  Just in case the code was actually
used... :)
msg12398 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-14 08:54
Logged In: YES 
user_id=21627

When the test failed on the 16GB RAM machine, did you run
the original or the modified test?

The original test is supposed to fail since no machine can
accomodate sys.maxint/4 pointers.

By reducing the list size, you are breaking the test
purpose: the sole purpose of the test is to verify that a
MemoryError is raised in this case. By making the else-part
PASS also, you are not testing anything anymore (except that
it won't crash).
msg12399 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2002-09-14 14:14
Logged In: YES 
user_id=539787

Obviously I ran the modified test.  I didn't acknowledge the 
fact that the test *sought* failure, since for all sane builds of 
python, RAM cannot be more than sys.maxint.  I didn't 
interpret "/ 4" as "/ struct.calcsize('P')".

Point taken, thanks for your time Martin.  Let's close this.
History
Date User Action Args
2022-04-10 16:05:40adminsetgithub: 37177
2002-09-13 18:54:09tzotcreate