Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with fix in ip/__init__.py (version 0.7.5) #2

Closed
keesbos opened this issue Nov 12, 2010 · 1 comment
Closed

Bug with fix in ip/__init__.py (version 0.7.5) #2

keesbos opened this issue Nov 12, 2010 · 1 comment

Comments

@keesbos
Copy link

keesbos commented Nov 12, 2010

  File "/usr/lib/python2.5/site-packages/netaddr-0.7.5-py2.5.egg/netaddr/ip/__init__.py", line 919, in __init__
    implicit_prefix, flags)
  File "/usr/lib/python2.5/site-packages/netaddr-0.7.5-py2.5.egg/netaddr/ip/__init__.py", line 782, in parse_ip_network
    value = ip._value
UnboundLocalError: local variable 'ip' referenced before assignment

val1 contained 'any', which is not ip4 nor ip6

Fix:

diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
index 0179c38..01d3747 100644
--- a/netaddr/ip/__init__.py
+++ b/netaddr/ip/__init__.py
@@ -779,6 +779,8 @@ def parse_ip_network(module, addr, implicit_prefix=False, flags=0):
                 #   Try a partial IPv4 network address...
                 expanded_addr = _ipv4.expand_partial_address(val1)
                 ip = IPAddress(expanded_addr, module.version, flags=INET_PTON)
+            else:
+                raise
         value = ip._value
 
         try:
@drkjam
Copy link
Collaborator

drkjam commented Nov 25, 2010

Fixed in commit 80071f4.

citrix-openstack-build pushed a commit to citrix-openstack-build/requirements that referenced this issue Dec 5, 2013
Versions <= 0.7.4 do not support the "version" parameter on
netaddr.IPNetwork() which is used by Ironic (potentially other projects
as well).

Version == 0.7.5 contains a bug (netaddr/netaddr#2)
that affect the GenericUtilsTestCase.test_get_shortened_ipv6_cidr on
Ironic (potentially other projects as well)

So setting the version of netaddr to be >= 0.7.6 should avoid such issues.

Change-Id: I0218a3bb4f17f1a8101d3fa2d3910fb1645470cf
Related-Bug: #1234672
n0ano pushed a commit to n0ano/gantt that referenced this issue Dec 11, 2013
Work around bug in netaddr 0.7.5
netaddr/netaddr#2

Change-Id: I3e064860c3865d5029481e6d63c5284d275a0081
yrobla pushed a commit to yrobla/nova that referenced this issue Apr 15, 2014
Work around bug in netaddr 0.7.5
netaddr/netaddr#2

Change-Id: I3e064860c3865d5029481e6d63c5284d275a0081
drkjam pushed a commit that referenced this issue Aug 28, 2015
Pull updates from main code body
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants