lfs confusion
John Hunter
jdhunter at ace.bsd.uchicago.edu
Fri Sep 24 07:22:29 EDT 2004
>>>>> "Andrew" == Andrew Dalke <dalke at dalkescientific.com> writes:
>> I pass the 2**31 test but fail your sys.maxint * 3L
Andrew> Huh. I wonder what's going on there. Perhaps the Windows
Andrew> API used handles up to 2**32?
No, I can do 2**32 and much higher. Apparently, the limit on my
system is sys.maxint (which is *really big*)
>>> import sys
>>> sys.maxint
9223372036854775807
>>> fd.seek(sys.maxint)
>>> fd.seek(sys.maxint+1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: long int too large to convert to int
>>> fd.tell()
0
I suddenly realize what is going on. The CPU, the AMD Opteron 250, is
a 64 bit processor. I just got this machine and didn't know what kind
of CPU it had.
>>> 2**63
9223372036854775808L
Apparently, on 64bit systems, tell returns an int because an int can
address 2**63 bytes. So the acid test in the 64 bit era for LFS is to
try and seek to 2**31, not to check the return type of tell.
JDH
More information about the Python-list
mailing list