On branch swig-py3: fix resource warnings on Python 3 * subversion/bindings/swig/python/svn/fs.py (FileDiff.procs): New list variable to hold process objects (FileDiff.get_pipe): Hold process object to self.procs. (FileDiff.__del__): Kill processes if they are alive before delete. * subversion/bindings/swig/python/tests/fs.py (SubversionFSTestCase.test_diff_repos_paths_internal, SubversionFSTestCase.test_diff_repos_paths_external): explicitly close pipe. Index: subversion/bindings/swig/python/svn/fs.py =================================================================== --- subversion/bindings/swig/python/svn/fs.py (revision 1867729) +++ subversion/bindings/swig/python/svn/fs.py (working copy) @@ -60,6 +60,7 @@ self.tempfile1 = None self.tempfile2 = None self.difftemp = None + self.procs = [] self.root1 = root1 self.path1 = path1 @@ -124,6 +125,7 @@ # open the pipe, and return the file object for reading from the child. p = _subprocess.Popen(cmd, stdout=_subprocess.PIPE, bufsize=-1, close_fds=_sys.platform != "win32") + self.procs.append(p) return p.stdout else: @@ -158,3 +160,12 @@ _os.remove(tmpfile) except OSError: pass + for proc in self.procs: + if proc.poll() is None: + proc.terminate() + if _sys.hexversion >= 0x030300F0: + try: + proc.wait(10) + except _subprocess.TimeoutExired: + proc.kill() + del proc Index: subversion/bindings/swig/python/tests/fs.py =================================================================== --- subversion/bindings/swig/python/tests/fs.py (revision 1867729) +++ subversion/bindings/swig/python/tests/fs.py (working copy) @@ -96,6 +96,7 @@ diffp = fdiff.get_pipe() diffoutput = diffp.read().decode('utf8') + diffp.close() self.assertTrue(diffoutput.find(u'-' + self.unistr) > 0) @@ -116,6 +117,7 @@ None, None, diffoptions=[]) diffp = fdiff.get_pipe() diffoutput = diffp.read().decode('utf8') + diffp.close() self.assertTrue(diffoutput.find(u'< ' + self.unistr) > 0)