diff mercurial/utils/procutil.py @ 48526:333a2656e981

pytype: stop excluding procutil.py This avoids these false warnings: File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 78, in <module>: No attribute 'register' on Type[io.BufferedIOBase] [attribute-error] File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 117, in <module>: No attribute 'register' on Type[io.IOBase] [attribute-error] File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 770, in runbgcommandpy3: No attribute 'close' on int [attribute-error] In Union[IO[Union[bytes, str]], int] Differential Revision: https://phab.mercurial-scm.org/D11927
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 14 Dec 2021 17:25:46 -0500
parents 8759e22f1649
children f8540fe4be0f
line wrap: on
line diff
--- a/mercurial/utils/procutil.py	Tue Dec 14 17:06:32 2021 -0500
+++ b/mercurial/utils/procutil.py	Tue Dec 14 17:25:46 2021 -0500
@@ -75,7 +75,9 @@
         return res
 
 
+# pytype: disable=attribute-error
 io.BufferedIOBase.register(LineBufferedWrapper)
+# pytype: enable=attribute-error
 
 
 def make_line_buffered(stream):
@@ -114,7 +116,9 @@
         return total_written
 
 
+# pytype: disable=attribute-error
 io.IOBase.register(WriteAllWrapper)
+# pytype: enable=attribute-error
 
 
 def _make_write_all(stream):
@@ -767,6 +771,7 @@
             raise
         finally:
             if stdin_bytes is not None:
+                assert not isinstance(stdin, int)
                 stdin.close()
         if not ensurestart:
             # Even though we're not waiting on the child process,