py3: ensure standard exceptions use `str` type strings in windows.py
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 26 Sep 2018 21:25:18 -0400
changeset 39883 2209e72f9fcb
parent 39882 c841e8855cd3
child 39884 9c8eff5cfa1b
py3: ensure standard exceptions use `str` type strings in windows.py See also edaa40dc5fe5.
mercurial/windows.py
--- a/mercurial/windows.py	Wed Sep 26 20:49:28 2018 -0400
+++ b/mercurial/windows.py	Wed Sep 26 21:25:18 2018 -0400
@@ -164,8 +164,8 @@
         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 @@
             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 @@
         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 @@
     return ''.join(chunks)
 
 def bindunixsocket(sock, path):
-    raise NotImplementedError('unsupported platform')
+    raise NotImplementedError(r'unsupported platform')