summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-08-20 00:04:26 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-08-20 00:04:26 (GMT)
commita8517ad3d9ac743a1bdd7e590e28a0da169f6e91 (patch)
tree9679e234fbb24bfc03ae1932ed0bb646a24f0180 /Lib/ipaddress.py
parent749bd42072c3ecf04be3e38ca479e48692bbfd7e (diff)
downloadcpython-a8517ad3d9ac743a1bdd7e590e28a0da169f6e91.zip
cpython-a8517ad3d9ac743a1bdd7e590e28a0da169f6e91.tar.gz
cpython-a8517ad3d9ac743a1bdd7e590e28a0da169f6e91.tar.bz2
Issue #14814: document the Interface APIs and fix various problems with the string representations (initial patch by Eli Bendersky).
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index c9338c5..cfc370c 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1336,7 +1336,8 @@ class IPv4Interface(IPv4Address):
@property
def with_prefixlen(self):
- return self
+ return '%s/%s' % (self._string_from_ip_int(self._ip),
+ self._prefixlen)
@property
def with_netmask(self):
@@ -1948,11 +1949,13 @@ class IPv6Interface(IPv6Address):
@property
def with_prefixlen(self):
- return self
+ return '%s/%s' % (self._string_from_ip_int(self._ip),
+ self._prefixlen)
@property
def with_netmask(self):
- return self.with_prefixlen
+ return '%s/%s' % (self._string_from_ip_int(self._ip),
+ self.netmask)
@property
def with_hostmask(self):