Mercurial > public > mercurial-scm > hg
diff mercurial/utils/procutil.py @ 49810:a9faacdc5943
typing: add type hints to mercurial/win32.py
These are the low level functions that are imported by the mercurial.windows
module, which is in turn imported by mercurial.utils as the platform module.
Pretty straightforward, but pytype inferred very little of it, likely because of
the heavy ctypes usage. It also seems to trigger a pytype bug in procutil, now
that it has an idea of the underlying function type, so disable that warning to
maintain a working test.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 15 Dec 2022 18:02:55 -0500 |
parents | 8147abc05794 |
children | 18c8c18993f0 |
line wrap: on
line diff
--- a/mercurial/utils/procutil.py Thu Dec 15 15:46:25 2022 -0500 +++ b/mercurial/utils/procutil.py Thu Dec 15 18:02:55 2022 -0500 @@ -585,7 +585,7 @@ return _gethgcmd() -def rundetached(args, condfn): +def rundetached(args, condfn) -> int: """Execute the argument list in a detached process. condfn is a callable which is called repeatedly and should return @@ -621,6 +621,12 @@ if prevhandler is not None: signal.signal(signal.SIGCHLD, prevhandler) + # pytype seems to get confused by not having a return in the finally + # block, and thinks the return value should be Optional[int] here. It + # appears to be https://github.com/google/pytype/issues/938, without + # the `with` clause. + pass # pytype: disable=bad-return-type + @contextlib.contextmanager def uninterruptible(warn):