exporting patch: # HG changeset patch # User anatoly techtonik # Date 1271273064 -10800 # Node ID 9fea147a78a0747f9b5b12199e2a78b7231192ea # Parent 2092e63f68d97ba5677d9495556aa37b79ac0aeb fix bug #557585 GitFile breaks dulwich on Windows fix is to add os.O_BINARY flag as os.open doesn't open files as binary on this platform by default diff -r 2092e63f68d9 -r 9fea147a78a0 dulwich/file.py --- a/dulwich/file.py Wed Apr 07 23:59:26 2010 +0300 +++ b/dulwich/file.py Wed Apr 14 22:24:24 2010 +0300 @@ -52,7 +52,11 @@ def __init__(self, filename, mode, bufsize): self._filename = filename self._lockfilename = '%s.lock' % self._filename - fd = os.open(self._lockfilename, os.O_RDWR | os.O_CREAT | os.O_EXCL) + + flags = os.O_RDWR | os.O_CREAT | os.O_EXCL + if os.name == 'nt': + flags = flags | os.O_BINARY + fd = os.open(self._lockfilename, flags) self._file = os.fdopen(fd, mode, bufsize) for method in self.PROXY_METHODS: