This commit modifies the default value of the argument properties of
ServiceInfo’s __init__() to byte array (properties=b’’). This enables
to instantiate it without setting the properties argument. As it is,
and because properties is not mandatory, if a user does not specify
the argument, an exception (AssertionError) is thrown:
Traceback (most recent call last):
File "src/zeroconf-test.py", line 72, in <module>
zeroconf.register_service(service)
File "/home/jmpcm/zeroconf-test/src/zeroconf.py", line 1864, in register_service
self.send(out)
File "/home/jmpcm/zeroconf-test/src/zeroconf.py", line 2091, in send
packet = out.packet()
File "/home/jmpcm/zeroconf-test/src/zeroconf.py", line 1026, in packet
overrun_answers += self.write_record(answer, time_)
File "/home/jmpcm/zeroconf-test/src/zeroconf.py", line 998, in write_record
record.write(self)
File "/home/jmpcm/zeroconf-test/src/zeroconf.py", line 579, in write
out.write_string(self.text)
File "/home/jmpcm/zeroconf-test/src/zeroconf.py", line 903, in write_string
assert isinstance(value, bytes)
AssertionError
The argument can be either a dictionary or a byte array. The function
_set_properties() will always create a byte array with the user's
properties. Changing the default value to a byte array, avoids the
conversion to byte array and avoids the exception.