mercurial/lock.py
changeset 51283 81224afd938d
parent 50926 18c8c18993f0
child 51494 9da3fcc5f70f
--- a/mercurial/lock.py	Wed Dec 20 12:51:20 2023 +0100
+++ b/mercurial/lock.py	Wed Dec 20 20:13:22 2023 +0100
@@ -12,6 +12,7 @@
 import signal
 import socket
 import time
+import typing
 import warnings
 
 from .i18n import _
@@ -154,8 +155,12 @@
             if delay == warningidx:
                 printwarning(ui.warn, inst.locker)
             if timeout <= delay:
+                assert isinstance(inst.filename, bytes)
                 raise error.LockHeld(
-                    errno.ETIMEDOUT, inst.filename, l.desc, inst.locker
+                    errno.ETIMEDOUT,
+                    typing.cast(bytes, inst.filename),
+                    l.desc,
+                    inst.locker,
                 )
             time.sleep(1)
             delay += 1
@@ -290,8 +295,13 @@
                             locker,
                         )
                 else:
+                    assert isinstance(why.filename, bytes)
+                    assert isinstance(why.strerror, str)
                     raise error.LockUnavailable(
-                        why.errno, why.strerror, why.filename, self.desc
+                        why.errno,
+                        why.strerror,
+                        typing.cast(bytes, why.filename),
+                        self.desc,
                     )
 
         if not self.held: