The attached code snippet is contains a function with a
return value using the percent operator, but the
interpreter complains about a TypeError, which is
incorrect.
Output from script is:
chris@py:~/tmp/Python-2.4$ ./python ~/python/bug.py
10 <type 'int'>
0 <type 'int'>
0 <type 'int'>
0 <type 'int'>
Traceback (most recent call last):
File "/home/chris/python/bug.py", line 13, in ?
str_ip = string_ip_from_long(0x0a000000L)
File "/home/chris/python/bug.py", line 11, in
string_ip_from_long
return ('%d.%d.%d.%d' % octets)
TypeError: int argument required
I've been able to reproduce this problem using versions:
Python 2.2.3 (#1, Jun 16 2003, 13:21:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Python 2.3.4 (#1, Jun 11 2004, 12:13:19)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Python 2.3.4 (#2, Nov 21 2004, 23:17:26)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
(Sparc64 box:)
Python 2.3.4 (#2, Dec 3 2004, 17:25:48)
[GCC 3.3.5 (Debian 1:3.3.5-2)] on linux2
Python version details: 2.4 (#1, Jan 14 2005, 17:20:35)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)]
|