[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#785275: ITP: python-ipaddress -- Backport of the ipaddress module from Python 3.3

Control: tag -1 - wontfix

On Fri, 22 May 2015 at 17:06 Scott Kitterman <debian@kitterman.com> wrote:
There are far more users of ipaddr than ipaddress.  There's exactly two API differences.  I'm willing to look at pip and propose a patch to work with either.

I've discovered yet another API incompatibility which affects python-cryptography:

>>> import ipaddr, ipaddress
>>> ipaddress.ip_address(b'\x7f\x00\x00\x01')
>>> ipaddr.IPAddress(b'\x7f\x00\x00\x01')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mithrandi/deployment/virtualenvs/tempenv-56cd218832e2d/local/lib/python2.7/site-packages/ipaddr.py", line 78, in IPAddress
ValueError: '\x7f\x00\x00\x01' does not appear to be an IPv4 or IPv6 address

The reason is that ipaddr requires you to use the ipaddr.Bytes wrapper type, rather than a normal bytes object, for packed addresses. Closer examination reveals that the entire module appears to be API-incompatible with ipaddress with regard to string types; ipaddress expects to receive unpacked addresses as unicode objects, but ipaddr expects them as bytes (not Bytes) objects. This break in compatibility probably goes unnoticed in most situations due to implicit encoding/decoding, but at this point I am seriously uncomfortable trying to work around these API differences in a patch to cryptography (or any other future package I work on that depends on ipaddress, for that matter). Thus I am renewing my intention to package python-ipaddress for use as a dependency of python-cryptography.

Reply to: