##// END OF EJS Templates
py3: create built in exceptions with str type messages in win32.py...
Matt Harbison -
r39798:edaa40dc default
parent child Browse files
Show More
@@ -307,8 +307,8 b' def _raiseoserror(name):'
307 if code > 0x7fffffff:
307 if code > 0x7fffffff:
308 code -= 2**32
308 code -= 2**32
309 err = ctypes.WinError(code=code)
309 err = ctypes.WinError(code=code)
310 raise OSError(err.errno, '%s: %s' % (name,
310 raise OSError(err.errno, r'%s: %s' % (encoding.strfromlocal(name),
311 encoding.strtolocal(err.strerror)))
311 err.strerror))
312
312
313 def _getfileinfo(name):
313 def _getfileinfo(name):
314 fh = _kernel32.CreateFileA(name, 0,
314 fh = _kernel32.CreateFileA(name, 0,
@@ -597,7 +597,8 b' def unlink(f):'
597 # use EPERM because it is POSIX prescribed value, even though
597 # use EPERM because it is POSIX prescribed value, even though
598 # unlink(2) on directories returns EISDIR on Linux
598 # unlink(2) on directories returns EISDIR on Linux
599 raise IOError(errno.EPERM,
599 raise IOError(errno.EPERM,
600 "Unlinking directory not permitted: '%s'" % f)
600 r"Unlinking directory not permitted: '%s'"
601 % encoding.strfromlocal(f))
601
602
602 # POSIX allows to unlink and rename open files. Windows has serious
603 # POSIX allows to unlink and rename open files. Windows has serious
603 # problems with doing that:
604 # problems with doing that:
@@ -625,7 +626,7 b' def unlink(f):'
625 if e.errno != errno.EEXIST:
626 if e.errno != errno.EEXIST:
626 raise
627 raise
627 else:
628 else:
628 raise IOError(errno.EEXIST, "No usable temporary filename found")
629 raise IOError(errno.EEXIST, r"No usable temporary filename found")
629
630
630 try:
631 try:
631 os.unlink(temp)
632 os.unlink(temp)
General Comments 0
You need to be logged in to leave comments. Login now