# HG changeset patch # User Augie Fackler # Date 1311627884 18000 # Node ID a3f97038c1c29f74685b8a49a80e34b5d2a85ae7 # Parent b7dbe957585c6fd2b84c7ac5d1e45f675af4b48f windows: use getattr instead of hasattr diff -r b7dbe957585c -r a3f97038c1c2 mercurial/windows.py --- a/mercurial/windows.py Mon Jul 25 16:04:40 2011 -0500 +++ b/mercurial/windows.py Mon Jul 25 16:04:44 2011 -0500 @@ -99,8 +99,9 @@ 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))