anydbm - a simple question

Randall Hopper aa8vb at yahoo.com
Mon Jan 24 10:56:28 EST 2000


Andrew M. Kuchling:
 |Randall Hopper <aa8vb at yahoo.com> writes:
 |>  File "/home/rhh/software/python-1.5.2/lib/python1.5/dumbdbm.py", line 87,\
 |>    in _addval
 |>    f.write('\0'*(npos-pos))
 |>TypeError: can't multiply sequence with non-int
 |
 |I'll bet you're on Solaris and are picking up the large file support,

Actually, no, I'm on SGI IRIX.

 |which makes the .tell() method of file objects return a long integer.
 |But you can't multiply a sequence by a long integer, only a regular
 |integer:

Yes, that's it.  But apparently it's not just a Solaris issue.

On IRIX:

    >>> open( "/etc/passwd", "r" ).tell()
    0L

 |Short-term, you can patch dumbdbm.py to use int(npos-pos), but this is
 |really an interpreter bug; there's no reason 2L * 'a' should be an
 |error.

Ok, thanks, I'll do that.

On a related not, another rough spot in non-uniform long int support
cropped up in another thread just recently:

    >>> str( 0x80000000L )
    '2147483648L'
    >>> "%ld" % 0x80000000L
    OverflowError: long int too long to convert

Hopefully long int support is on the Python v2 list of wrinkles to smooth.

-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list