timmerk / ipaddr-py

Automatically exported from code.google.com/p/ipaddr-py
0 stars 0 forks source link

Regression from ipaddr v1 with '%x' % IPv6Address('2001:db8::1') #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

#!/usr/bin/python2.4

import ipaddrv1
import ipaddrv2

x = ipaddrv1.IP('172.0.2.0/24')
print 'ipaddr 1, IPv4: %x' % x.ip

x = ipaddrv1.IP('2001:db8::/32')
print 'ipaddr 1, IPv6: %x' % x.ip

x = ipaddrv2.IPNetwork('172.0.2.0/24')
print 'ipaddr 2, IPv4: %x' % x.ip

x = ipaddrv2.IPNetwork('2001:db8::/32')
print 'ipaddr 2, IPv6: %x' % x.ip

:!./ipaddr_regression.py
ipaddr 1, IPv4: ac000200
ipaddr 1, IPv6: 20010db8000000000000000000000000
ipaddr 2, IPv4: ac000200
Traceback (most recent call last):
  File "./ipaddr_regression.py", line 16, in ?
    print 'ipaddr 2, IPv6: %x' % x.ip
TypeError: int argument required

What is the expected output? What do you see instead?

I would expect '%x' % ipaddr.IPv6Address('2001:db8::1') to still work.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by sm...@google.com on 15 Jul 2010 at 10:01

GoogleCodeExporter commented 9 years ago
From Mike:

class C(object):
 def __int__(self):
   return 2**16

class D(object):
 def __int__(self):
   return 2**64

print '%x' % C()  # ok
print '%x' % D()  # TypeError

Original comment by sm...@google.com on 15 Jul 2010 at 10:03

GoogleCodeExporter commented 9 years ago
You ended up fixing this internally, didn't you?  Did the fix make it to 
code.google.com?

Original comment by pmo...@google.com on 19 Sep 2010 at 1:55

GoogleCodeExporter commented 9 years ago
No to both questions.

Original comment by sm...@google.com on 19 Sep 2010 at 3:15

GoogleCodeExporter commented 9 years ago
Matt, did you have a fix for this?

Original comment by pmo...@google.com on 4 Jan 2011 at 5:03

GoogleCodeExporter commented 9 years ago
No, I didn't have a fix for this.

Original comment by sm...@google.com on 4 Jan 2011 at 5:54

GoogleCodeExporter commented 9 years ago
this seems to be an issue specifically with python2.4. I'm going to mark this 
as wontfix unless you think there's a reason that we should be supporting 2.4

>>> '%x' % ipaddr.IPNetwork('2001:db8::1/32') 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: int argument required
>>> sys.version
'2.4.6 (#1, Nov 23 2009, 03:28:22) \n[GCC 4.2.2]'

>>> '%x' % ipaddr.IPNetwork('2001:db8::1/32')
'20010db8000000000000000000000001'
>>> sys.version
'2.6.5 (r265:79063, Apr 16 2010, 13:57:41) \n[GCC 4.4.3]'

Original comment by pmo...@google.com on 8 Jan 2011 at 2:47

GoogleCodeExporter commented 9 years ago
I verified the regression doesn't exist for Python 2.6.  I'm fine with wontfix.

Original comment by sm...@google.com on 10 Jan 2011 at 5:09