diff -r e9165c18f8df -r cde6904f1992 mercurial/httppeer.py --- a/mercurial/httppeer.py Fri Oct 24 14:24:28 2014 -0700 +++ b/mercurial/httppeer.py Sat Oct 25 21:34:49 2014 -0400 @@ -214,6 +214,7 @@ def _calltwowaystream(self, cmd, fp, **args): fh = None + fp_ = None filename = None try: # dump bundle to disk @@ -225,10 +226,12 @@ d = fp.read(4096) fh.close() # start http push - fp = httpconnection.httpsendfile(self.ui, filename, "rb") + fp_ = httpconnection.httpsendfile(self.ui, filename, "rb") headers = {'Content-Type': 'application/mercurial-0.1'} - return self._callstream(cmd, data=fp, headers=headers, **args) + return self._callstream(cmd, data=fp_, headers=headers, **args) finally: + if fp_ is not None: + fp_.close() if fh is not None: fh.close() os.unlink(filename)