# HG changeset patch # User Augie Fackler # Date 2011-07-25 21:04:44 # Node ID a3f97038c1c29f74685b8a49a80e34b5d2a85ae7 # Parent b7dbe957585c6fd2b84c7ac5d1e45f675af4b48f windows: use getattr instead of hasattr diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -99,8 +99,9 @@ def checklink(path): def setbinary(fd): # When run without console, pipes may expose invalid # fileno(), usually set to -1. - if hasattr(fd, 'fileno') and fd.fileno() >= 0: - msvcrt.setmode(fd.fileno(), os.O_BINARY) + fno = getattr(fd, 'fileno', None) + if fno is not None and fno() >= 0: + msvcrt.setmode(fno(), os.O_BINARY) def pconvert(path): return '/'.join(path.split(os.sep))