changeset 39888:2209e72f9fcb

py3: ensure standard exceptions use `str` type strings in windows.py See also edaa40dc5fe5.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 26 Sep 2018 21:25:18 -0400
parents c841e8855cd3
children 9c8eff5cfa1b
files mercurial/windows.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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')