Mercurial > hg-stable
changeset 14969:a3f97038c1c2
windows: use getattr instead of hasattr
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 25 Jul 2011 16:04:44 -0500 |
parents | b7dbe957585c |
children | 592e45b7d43e |
files | mercurial/windows.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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))