comparison mercurial/windows.py @ 39883: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 68ea1f8dcb84
children 5fe0b880200e
comparison
equal deleted inserted replaced
39882:c841e8855cd3 39883:2209e72f9fcb
162 return mixedfilemodewrapper(fp) 162 return mixedfilemodewrapper(fp)
163 163
164 return fp 164 return fp
165 except WindowsError as err: 165 except WindowsError as err:
166 # convert to a friendlier exception 166 # convert to a friendlier exception
167 raise IOError(err.errno, '%s: %s' % ( 167 raise IOError(err.errno, r'%s: %s' % (
168 name, encoding.strtolocal(err.strerror))) 168 encoding.strfromlocal(name), err.strerror))
169 169
170 # may be wrapped by win32mbcs extension 170 # may be wrapped by win32mbcs extension
171 listdir = osutil.listdir 171 listdir = osutil.listdir
172 172
173 class winstdout(object): 173 class winstdout(object):
199 start = end 199 start = end
200 except IOError as inst: 200 except IOError as inst:
201 if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst): 201 if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
202 raise 202 raise
203 self.close() 203 self.close()
204 raise IOError(errno.EPIPE, 'Broken pipe') 204 raise IOError(errno.EPIPE, r'Broken pipe')
205 205
206 def flush(self): 206 def flush(self):
207 try: 207 try:
208 return self.fp.flush() 208 return self.fp.flush()
209 except IOError as inst: 209 except IOError as inst:
210 if not win32.lasterrorwaspipeerror(inst): 210 if not win32.lasterrorwaspipeerror(inst):
211 raise 211 raise
212 raise IOError(errno.EPIPE, 'Broken pipe') 212 raise IOError(errno.EPIPE, r'Broken pipe')
213 213
214 def _is_win_9x(): 214 def _is_win_9x():
215 '''return true if run on windows 95, 98 or me.''' 215 '''return true if run on windows 95, 98 or me.'''
216 try: 216 try:
217 return sys.getwindowsversion()[3] == 1 217 return sys.getwindowsversion()[3] == 1
614 chunks.append(s) 614 chunks.append(s)
615 615
616 return ''.join(chunks) 616 return ''.join(chunks)
617 617
618 def bindunixsocket(sock, path): 618 def bindunixsocket(sock, path):
619 raise NotImplementedError('unsupported platform') 619 raise NotImplementedError(r'unsupported platform')