From 4fcf3c7416f9fdb5b7230f0ce22d4c1378e5bd3e Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sat, 17 Dec 2011 06:58:36 +0100 Subject: [PATCH 1/1] Close perfproxies on __del__. --- pdm/cli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -- 2.11.0