--- a/mercurial/windows.py Mon Jan 06 14:15:40 2025 -0500
+++ b/mercurial/windows.py Sun Jan 05 21:03:17 2025 -0500
@@ -191,9 +191,9 @@
return mixedfilemodewrapper(fp)
return fp
- except WindowsError as err: # pytype: disable=name-error
+ except OSError as err:
# convert to a friendlier exception
- raise IOError(
+ raise OSError(
err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
)
@@ -242,25 +242,25 @@
def close(self):
try:
self.fp.close()
- except IOError:
+ except OSError:
pass
def write(self, s):
try:
return self.fp.write(s)
- except IOError as inst:
+ except OSError as inst:
if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
raise
self.close()
- raise IOError(errno.EPIPE, 'Broken pipe')
+ raise OSError(errno.EPIPE, 'Broken pipe')
def flush(self):
try:
return self.fp.flush()
- except IOError as inst:
+ except OSError as inst:
if not win32.lasterrorwaspipeerror(inst):
raise
- raise IOError(errno.EPIPE, 'Broken pipe')
+ raise OSError(errno.EPIPE, 'Broken pipe')
def openhardlinks() -> bool:
@@ -744,7 +744,7 @@
# never let a Unicode string escape into the wild
return encoding.unitolocal(val)
- except EnvironmentError:
+ except OSError:
pass