summaryrefslogtreecommitdiff
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-07-07 22:15:22 +1000
committerNick Coghlan <ncoghlan@gmail.com>2012-07-07 22:15:22 +1000
commitd1bf0e38f03a795012b9669fc5f1bb62940f584d (patch)
treeace76a51f3f7ef553ef400233798dba7cf016223 /Lib/ipaddress.py
parent27b867afd964eaeb6994b2eb33cec69229e53152 (diff)
downloadcpython-d1bf0e38f03a795012b9669fc5f1bb62940f584d.tar.gz
Issue 14814: Explain how to get more error detail in the ipaddress tutorial, and tweak the display for octet errors in IPv4 (noticed the formatting problem when adding to the docs)
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index bd79e2a1dd..e788c0a5b7 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1048,7 +1048,7 @@ class _BaseV4:
raise ValueError("Ambiguous leading zero in %r not permitted" %
octet_str)
if octet_int > 255:
- raise ValueError("Octet %d > 255 not permitted" % octet_int)
+ raise ValueError("Octet %d (> 255) not permitted" % octet_int)
return octet_int
def _string_from_ip_int(self, ip_int):
@@ -1591,7 +1591,8 @@ class _BaseV6:
hextet_int = int(hextet_str, 16)
if hextet_int > 0xFFFF:
# This is unreachable due to the string length check above
- raise ValueError("Part %d > 0xFFFF not permitted" % hextet_int)
+ msg = "Part 0x%X (> 0xFFFF) not permitted"
+ raise ValueError(msg % hextet_int)
return hextet_int
def _compress_hextets(self, hextets):