Bläddra i källkod

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

anatoly techtonik 15 år sedan
förälder
incheckning
93c83d15c1
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      dulwich/file.py

+ 2 - 1
dulwich/file.py

@@ -89,7 +89,8 @@ class _GitFile(object):
     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)
+        fd = os.open(self._lockfilename,
+            os.O_RDWR | os.O_CREAT | os.O_EXCL | getattr(os, "O_BINARY", 0))
         self._file = os.fdopen(fd, mode, bufsize)
         self._closed = False