[Python-bugs-list] Operator breakage with long int operands (PR#187)
aa8vb@yahoo.com
aa8vb@yahoo.com
Mon, 24 Jan 2000 11:19:13 -0500 (EST)
Full_Name: Randall Hopper
Version: 1.5.2
OS: IRIX 6.5
Submission from: ralph.rtpnc.epa.gov (134.67.66.44)
This came up a few weeks ago, and bit again in the dumbdbm module last week.
In the dumbdbm module in 1.5.2:
'\0'*(npos-pos)
(npos-pos) on some OSs will be a long int. However, the '*' operator won't
handle a long int. I can't think of a reason why 'a'*10L should be invalid,
for example.
At issue a few weeks ago was long ints and the '%' operator. For example:
>>> str( 0x80000000L )
'2147483648L'
>>> "%ld" % 0x80000000L
OverflowError: long int too long to convert
>>> hex( 0x80000000L )
'0x80000000L'
>>> "%lX" % 0x80000000L
OverflowError: long int too long to convert
Couldn't % use hex() and str() under the hood, for instance?