From: Fredrik Tolf Date: Sat, 17 Dec 2011 05:58:36 +0000 (+0100) Subject: Close perfproxies on __del__. X-Git-Tag: 0.1~2^2~4 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=4fcf3c7416f9fdb5b7230f0ce22d4c1378e5bd3e;hp=cfc372bf6dba593333f2ff5ba226cf7fb71afa12;p=pdm.git Close perfproxies on __del__. --- diff --git a/pdm/cli.py b/pdm/cli.py index d88ebbd..4e158d8 100644 --- a/pdm/cli.py +++ b/pdm/cli.py @@ -150,8 +150,13 @@ class perfproxy(object): except: pass def close(self): - self.cl.run("unbind", self.id) - del self.cl.proxies[self.id] + if self.id is not None: + self.cl.run("unbind", self.id) + del self.cl.proxies[self.id] + self.id = None + + def __del__(self): + self.close() def __enter__(self): return self