diff -r 3f754be7abbb -r 4e836769d93c 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))