changeset 51799:1888846a1ee2

typing: fix the hint for the `mode` argument of `platform.copymode()` The posix module is doing a bitwise AND with this and an integer, so it can't be bytes. The only caller that provides the argument is `util.mktempcopy()`, and pytype infers the type as Any, which explains why this wasn't caught.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Aug 2024 14:18:44 -0400
parents 2f8e7e384178
children 62806be5cbda
files mercurial/posix.py mercurial/windows.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Fri May 05 06:08:36 2023 -0600
+++ b/mercurial/posix.py	Sat Aug 10 14:18:44 2024 -0400
@@ -213,7 +213,7 @@
 def copymode(
     src: bytes,
     dst: bytes,
-    mode: Optional[bytes] = None,
+    mode: Optional[int] = None,
     enforcewritable: bool = False,
 ) -> None:
     """Copy the file mode from the file at path src to dst.
--- a/mercurial/windows.py	Fri May 05 06:08:36 2023 -0600
+++ b/mercurial/windows.py	Sat Aug 10 14:18:44 2024 -0400
@@ -297,7 +297,7 @@
 def copymode(
     src: bytes,
     dst: bytes,
-    mode: Optional[bytes] = None,
+    mode: Optional[int] = None,
     enforcewritable: bool = False,
 ) -> None:
     pass