changeset 47856:ad2c37075f46 stable

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
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 18 Aug 2021 14:58:42 -0400
parents 8d297f3563be
children 95af358fcdfe
files hgext/zeroconf/Zeroconf.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/zeroconf/Zeroconf.py	Tue Aug 24 23:42:35 2021 +0200
+++ b/hgext/zeroconf/Zeroconf.py	Wed Aug 18 14:58:42 2021 -0400
@@ -770,7 +770,7 @@
 
     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