diff options
author | mshields@google.com <mshields@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035> | 2010-08-16 23:43:35 +0000 |
---|---|---|
committer | mshields@google.com <mshields@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035> | 2010-08-16 23:43:35 +0000 |
commit | 7e91ca6930979dcf98087419fe2f83ceecce8f52 (patch) | |
tree | 5e2f07fa25cc8523da37c3143a8069140324bc34 | |
parent | 5dd30f7a76ae0ed275f1a23500b7d29de6112304 (diff) | |
download | ipaddr-py-7e91ca6930979dcf98087419fe2f83ceecce8f52.tar.gz |
Fix for issue 66, contributed by Lorenzo Colitti of Google.
git-svn-id: https://ipaddr-py.googlecode.com/svn@177 09200d28-7f98-11dd-ad27-0f66e57d2035
-rw-r--r-- | trunk/ipaddr.py | 3 | ||||
-rwxr-xr-x | trunk/ipaddr_test.py | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/trunk/ipaddr.py b/trunk/ipaddr.py index 1d25e55..7b94cd8 100644 --- a/trunk/ipaddr.py +++ b/trunk/ipaddr.py @@ -1761,6 +1761,9 @@ class IPv6Address(_BaseV6, _BaseIP): if not addr_str: raise AddressValueError('') + if not self._is_valid_ip(addr_str): + raise AddressValueError(addr_str) + self._ip = self._ip_int_from_string(addr_str) diff --git a/trunk/ipaddr_test.py b/trunk/ipaddr_test.py index 61ac4b0..e0f6431 100755 --- a/trunk/ipaddr_test.py +++ b/trunk/ipaddr_test.py @@ -103,6 +103,10 @@ class IpaddrUnitTest(unittest.TestCase): '1234:axy::b') self.assertRaises(ipaddr.AddressValueError, ipaddr.IPv6Address, '1234:axy::b') + self.assertRaises(ipaddr.AddressValueError, ipaddr.IPv6Address, + '2001:db8:::1') + self.assertRaises(ipaddr.AddressValueError, ipaddr.IPv6Address, + '2001:888888::1') self.assertRaises(ipaddr.AddressValueError, ipaddr.IPv4Address(1)._ip_int_from_string, '1.a.2.3') |