util: test fileno() availability in win32 set_binary()
authorPatrick Mezard <pmezard@gmail.com>
Thu, 20 Mar 2008 22:41:40 +0100
changeset 6330 4e836769d93c
parent 6329 3f754be7abbb
child 6331 627665e37bdd
util: test fileno() availability in win32 set_binary() Fix suggested by Alexander Belchenko <bialix@ukr.net>
mercurial/util.py
--- a/mercurial/util.py	Thu Mar 20 15:59:54 2008 -0500
+++ b/mercurial/util.py	Thu Mar 20 22:41:40 2008 +0100
@@ -1000,7 +1000,8 @@
         pass
 
     def set_binary(fd):
-        msvcrt.setmode(fd.fileno(), os.O_BINARY)
+        if hasattr(fd, 'fileno'):
+            msvcrt.setmode(fd.fileno(), os.O_BINARY)
 
     def pconvert(path):
         return '/'.join(splitpath(path))