[PATCH] define self.pipe in a new __init__ method



The sentinel class in misc.py does not define self.pipe
in its constructor (because there's none) but that
variable is used in the __del__ method.

This is currently not a problem since the way this inner
class is used is to always call __call__ immediately
after having created an instance, but I think we should
still do the safe thing...

-- 
Vincent Legoll
Index: misc.py
===================================================================
--- misc.py	(revision 1294)
+++ misc.py	(working copy)
@@ -182,6 +182,8 @@
     If 'workdir' is specified the command is run from that directory.
     """
     class sentinel(object):
+        def __init__(self):
+            self.pipe = None
         def __del__(self):
             if self.pipe:
                 errorstream.write("killing '%s' with pid '%i'\n" % (command[0], self.pipe.pid))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]