Relax address validation to allow for port 0 (aka "pick any free one").

This commit is contained in:
Pavel Minaev 2018-10-12 21:41:25 -07:00
parent 7b302c73f0
commit 5cb80239f3

View file

@ -267,8 +267,8 @@ class Address(namedtuple('Address', 'host port')):
def __init__(self, *args, **kwargs):
if self.port is None:
raise TypeError('missing port')
if self.port <= 0 or self.port > 65535:
raise ValueError('port must be positive int < 65535')
if self.port < 0 or self.port > 65535:
raise ValueError('port must be non-negative int < 65535')
def __repr__(self):
orig = super(Address, self).__repr__()