# HG changeset patch # User Matt Harbison # Date 2021-08-18 18:58:42 # Node ID ad2c37075f46ed9f1134b97b96f816c6bef50cd9 # Parent 8d297f3563be1ad02a8f73d96a2416348a228576 zeroconf: fix an issue concatenating bytes and str `bytes(length)` doesn't do what we want, so use `str`. There appear to be a ton more issues in this extension, including: - globals()[b'_GLOBAL_DONE'] using bytes as the key - `__author__` and similar using bytes - `BadDomainName` is feeding bytes to the Exception constructor - DNSRecord.toString() has the wrong signature (should be str, not bytes) Differential Revision: https://phab.mercurial-scm.org/D11303 diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py --- a/hgext/zeroconf/Zeroconf.py +++ b/hgext/zeroconf/Zeroconf.py @@ -770,7 +770,7 @@ class DNSOutgoing(object): def writeString(self, value, length): """Writes a string to the packet""" - format = b'!' + str(length) + b's' + format = '!' + str(length) + 's' self.data.append(struct.pack(format, value)) self.size += length