[PATCH 2 of 4] py3: ensure standard exceptions use `str` type strings in windows.py
Matt Harbison
mharbison72 at gmail.com
Thu Sep 27 03:12:54 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1538011518 14400
# Wed Sep 26 21:25:18 2018 -0400
# Node ID e37a4df2bf1523b9f03ddbfe5db0209058e6c8f0
# Parent 88db05d80c8b8380861864e922ebea7567f372c2
py3: ensure standard exceptions use `str` type strings in windows.py
See also edaa40dc5fe5.
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -164,8 +164,8 @@ def posixfile(name, mode='r', buffering=
return fp
except WindowsError as err:
# convert to a friendlier exception
- raise IOError(err.errno, '%s: %s' % (
- name, encoding.strtolocal(err.strerror)))
+ raise IOError(err.errno, r'%s: %s' % (
+ encoding.strfromlocal(name), err.strerror))
# may be wrapped by win32mbcs extension
listdir = osutil.listdir
@@ -201,7 +201,7 @@ class winstdout(object):
if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
raise
self.close()
- raise IOError(errno.EPIPE, 'Broken pipe')
+ raise IOError(errno.EPIPE, r'Broken pipe')
def flush(self):
try:
@@ -209,7 +209,7 @@ class winstdout(object):
except IOError as inst:
if not win32.lasterrorwaspipeerror(inst):
raise
- raise IOError(errno.EPIPE, 'Broken pipe')
+ raise IOError(errno.EPIPE, r'Broken pipe')
def _is_win_9x():
'''return true if run on windows 95, 98 or me.'''
@@ -616,4 +616,4 @@ def readpipe(pipe):
return ''.join(chunks)
def bindunixsocket(sock, path):
- raise NotImplementedError('unsupported platform')
+ raise NotImplementedError(r'unsupported platform')
More information about the Mercurial-devel
mailing list