You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by fu...@apache.org on 2019/09/30 15:04:44 UTC

svn commit: r1867779 - /subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py

Author: futatuki
Date: Mon Sep 30 15:04:44 2019
New Revision: 1867779

URL: http://svn.apache.org/viewvc?rev=1867779&view=rev
Log:
On branch swig-py3: follow-up to 1867740: Fix issues in new clean up code

* subversion/bindings/swig/python/svn/fs.py (FileDiff.__del__):
 - Fix typo in exception class name.
 - Terminate subprocess only if its stdout is already closed.  
 - Terminate subprocess before remove temporary files.

 Patch by: Jun Omae <jun66j5 at gmail.com>
           me

Modified:
    subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py

Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py
URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py?rev=1867779&r1=1867778&r2=1867779&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py (original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py Mon Sep 30 15:04:44 2019
@@ -152,6 +152,16 @@ class FileDiff:
       return builtins.open(self.difftemp, "rb")
 
   def __del__(self):
+    # subprocess created by self.get_pipe() should be terminated only if
+    # its stdout is already closed
+    for proc in self.procs:
+      if proc.poll() is None and proc.stdout.closed:
+        proc.terminate()
+        if _sys.hexversion >= 0x030300F0:
+          try:
+            proc.wait(10)
+          except subprocess.TimeoutExpired:
+            proc.kill() 
     # it seems that sometimes the files are deleted, so just ignore any
     # failures trying to remove them
     for tmpfile in [self.tempfile1, self.tempfile2, self.difftemp]:
@@ -160,12 +170,3 @@ class FileDiff:
           _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