Mercurial > hg
changeset 14958:fd246aefedd3
keepalive: use safehasattr instead of hasattr
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 25 Jul 2011 20:36:59 -0500 |
parents | 16e5271b216f |
children | b1dcc5ab86cd |
files | mercurial/keepalive.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/keepalive.py Mon Jul 25 15:38:46 2011 -0500 +++ b/mercurial/keepalive.py Mon Jul 25 20:36:59 2011 -0500 @@ -547,13 +547,14 @@ print "send:", repr(str) try: blocksize = 8192 - if hasattr(str,'read') : + read = getattr(str, 'read', None) + if read is not None: if self.debuglevel > 0: print "sendIng a read()able" - data = str.read(blocksize) + data = read(blocksize) while data: self.sock.sendall(data) - data = str.read(blocksize) + data = read(blocksize) else: self.sock.sendall(str) except socket.error, v: