diff -r 2b8c8b8d1a06 -r ead71b15efd5 mercurial/lock.py --- a/mercurial/lock.py Sat May 26 03:01:14 2018 +0530 +++ b/mercurial/lock.py Wed Jun 06 13:31:24 2018 -0400 @@ -21,6 +21,7 @@ encoding, error, pycompat, + util, ) from .utils import ( @@ -177,7 +178,7 @@ def __init__(self, vfs, fname, timeout=-1, releasefn=None, acquirefn=None, desc=None, inheritchecker=None, parentlock=None, - dolock=True): + signalsafe=True, dolock=True): self.vfs = vfs self.f = fname self.held = 0 @@ -189,6 +190,10 @@ self.parentlock = parentlock self._parentheld = False self._inherited = False + if signalsafe: + self._maybedelayedinterrupt = _delayedinterrupt + else: + self._maybedelayedinterrupt = util.nullcontextmanager self.postrelease = [] self.pid = self._getpid() if dolock: @@ -244,7 +249,7 @@ while not self.held and retry: retry -= 1 try: - with _delayedinterrupt(): + with self._maybedelayedinterrupt(): self.vfs.makelock(lockname, self.f) self.held = 1 except (OSError, IOError) as why: