[Python-bugs-list] [ python-Bugs-609041 ] test_b1.py, disabling of list test

noreply@sourceforge.net noreply@sourceforge.net
Sat, 14 Sep 2002 07:14:05 -0700


Bugs item #609041, was opened at 2002-09-13 21:54
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=609041&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Christos Georgiou (tzot)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_b1.py, disabling of list test

Initial Comment:
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>

----------------------------------------------------------------------

>Comment By: Christos Georgiou (tzot)
Date: 2002-09-14 17:14

Message:
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.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-09-14 11:54

Message:
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).

----------------------------------------------------------------------

Comment By: Christos Georgiou (tzot)
Date: 2002-09-13 21:58

Message:
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... :)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=609041&group_id=5470