Changeset - 08b6aa79f213
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-10-03 22:59:06
mads@kiilerich.com
Grafted from: dfde0d3e7f00
vcs: drop subprocessio __del__ - it should no longer be necessary, and it might confuse both users and garbage collector

After 8dbe46ca608f, we always explicitly close so resources can be released
early.

__del__ makes it hard for the garbage collector to clean up, and it is
misleading to use it as if it was a reliable "Resource acquisition is
initialization" finale.
1 file changed with 0 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/subprocessio.py
Show inline comments
 
@@ -202,15 +202,12 @@ class BufferedGenerator(object):
 
        try:
 
            self.worker.stop()
 
            self.throw(GeneratorExit)
 
        except (GeneratorExit, StopIteration):
 
            pass
 

	
 
    def __del__(self):
 
        self.close()
 

	
 
    ####################
 
    # Threaded reader's infrastructure.
 
    ####################
 
    @property
 
    def input(self):
 
        return self.worker.w
 
@@ -423,9 +420,6 @@ class SubprocessIOChunker(object):
 
        except:
 
            pass
 
        try:
 
            os.close(self.inputstream)
 
        except:
 
            pass
 

	
 
    def __del__(self):
 
        self.close()
0 comments (0 inline, 0 general)