Avoid unnecessary string formatting

This commit is contained in:
Kovid Goyal 2013-07-04 12:18:24 +05:30
parent ef4efd5768
commit c950518da2

View File

@ -259,10 +259,10 @@ def samefile(src, dst):
def windows_hardlink(src, dest):
import win32file, pywintypes
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
try:
win32file.CreateHardLink(dest, src)
except pywintypes.error as e:
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
raise Exception(msg % e)
# We open and close dest, to ensure its directory entry is updated
# see http://blogs.msdn.com/b/oldnewthing/archive/2011/12/26/10251026.aspx
@ -273,6 +273,7 @@ def windows_hardlink(src, dest):
win32file.CloseHandle(h)
if sz != os.path.getsize(src):
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
raise Exception(msg % ('hardlink size: %d not the same as source size' % sz))
class WindowsAtomicFolderMove(object):