changeset 51701:97d013f48cae

zeroconf: fix boolean return value This was (wrongly) flagged by Pytype as being undefined since it doesn't seem to understand `try` blocks. However, the caller is expecting a boolean and the fix to appease Pytype is simple, so we do both.
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 18 Jul 2024 12:02:01 +0200
parents 7f0cb9ee0534
children b0a4de6c14f8
files hgext/zeroconf/Zeroconf.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/zeroconf/Zeroconf.py	Tue Jul 23 10:02:46 2024 +0200
+++ b/hgext/zeroconf/Zeroconf.py	Thu Jul 18 12:02:01 2024 +0200
@@ -1307,6 +1307,7 @@
         delay = _LISTENER_TIME
         next = now + delay
         last = now + timeout
+        result = False
         try:
             zeroconf.addListener(
                 self, DNSQuestion(self.name, _TYPE_ANY, _CLASS_IN)
@@ -1352,7 +1353,7 @@
 
                 zeroconf.wait(min(next, last) - now)
                 now = currentTimeMillis()
-            result = 1
+            result = True
         finally:
             zeroconf.removeListener(self)