safehasattr: pass attribute name as string instead of bytes
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Feb 2023 17:21:22 +0100
changeset 50591 9342271eef31
parent 50590 48e69a056754
child 50592 a5bba73a1352
safehasattr: pass attribute name as string instead of bytes This is a step toward replacing `util.safehasattr` usage with plain `hasattr`. The builtin function behave poorly in Python2 but this was fixed in Python3. These change are done one by one as they tend to have a small odd to trigger puzzling breackage.
mercurial/commandserver.py
--- a/mercurial/commandserver.py	Thu Feb 02 17:21:14 2023 +0100
+++ b/mercurial/commandserver.py	Thu Feb 02 17:21:22 2023 +0100
@@ -588,7 +588,7 @@
         o = socket.socketpair(socket.AF_UNIX, socket.SOCK_DGRAM)
         self._mainipc, self._workeripc = o
         self._servicehandler.bindsocket(self._sock, self.address)
-        if util.safehasattr(procutil, b'unblocksignal'):
+        if util.safehasattr(procutil, 'unblocksignal'):
             procutil.unblocksignal(signal.SIGCHLD)
         o = signal.signal(signal.SIGCHLD, self._sigchldhandler)
         self._oldsigchldhandler = o