Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_b1.py, disabling of list test #37177

Closed
tzot mannequin opened this issue Sep 13, 2002 · 4 comments
Closed

test_b1.py, disabling of list test #37177

tzot mannequin opened this issue Sep 13, 2002 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@tzot
Copy link
Mannequin

tzot mannequin commented Sep 13, 2002

BPO 609041
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2002-09-14.14:14:05.000>
created_at = <Date 2002-09-13.18:54:09.000>
labels = ['library']
title = 'test_b1.py, disabling of list test'
updated_at = <Date 2002-09-14.14:14:05.000>
user = 'https://bugs.python.org/tzot'

bugs.python.org fields:

activity = <Date 2002-09-14.14:14:05.000>
actor = 'tzot'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2002-09-13.18:54:09.000>
creator = 'tzot'
dependencies = []
files = []
hgrepos = []
issue_num = 609041
keywords = []
message_count = 4.0
messages = ['12396', '12397', '12398', '12399']
nosy_count = 2.0
nosy_names = ['loewis', 'tzot']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue609041'
versions = ['Python 2.3']

@tzot
Copy link
Mannequin Author

tzot mannequin commented Sep 13, 2002

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>

@tzot tzot mannequin closed this as completed Sep 13, 2002
@tzot tzot mannequin closed this as completed Sep 13, 2002
@tzot tzot mannequin added stdlib Python modules in the Lib dir labels Sep 13, 2002
@tzot
Copy link
Mannequin Author

tzot mannequin commented Sep 13, 2002

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

@loewis
Copy link
Mannequin

loewis mannequin commented Sep 14, 2002

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

@tzot
Copy link
Mannequin Author

tzot mannequin commented Sep 14, 2002

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants