watchman: refactor transport connecting to unconfuse pytype
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 05 Jan 2023 17:28:33 -0500
changeset 49856 40d3ee570d83
parent 49855 36afe74e4439
child 49857 ab32fd8412a7
watchman: refactor transport connecting to unconfuse pytype Pytype sees `self.proc` as potentially `None` here, even though it's set by the `_connect()` logic. Instead of asserting, simply use the process returned by that method (which it sets into `self.proc` before returning, so there's no functional change here).
hgext/fsmonitor/pywatchman/__init__.py
--- a/hgext/fsmonitor/pywatchman/__init__.py	Thu Jan 05 17:24:11 2023 -0500
+++ b/hgext/fsmonitor/pywatchman/__init__.py	Thu Jan 05 17:28:33 2023 -0500
@@ -689,9 +689,9 @@
         if self.closed:
             self.close()
             self.closed = False
-        self._connect()
-        res = self.proc.stdin.write(data)
-        self.proc.stdin.close()
+        proc = self._connect()
+        res = proc.stdin.write(data)
+        proc.stdin.close()
         self.closed = True
         return res