From 5cdd74bc9e017f8802f96d915131c8cf525d4146 Mon Sep 17 00:00:00 2001 From: Evan Dandrea Date: Tue, 12 Jun 2012 16:06:16 +0100 Subject: Drop __del__ statement, which is unsafe: http://www.algorithm.co.il/blogs/programming/python-gotchas-1-__del__-is-not-the-opposite-of-__init__/ --- apt/progress/base.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/base.py b/apt/progress/base.py index 88b1ad21..ab57dd82 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -142,14 +142,11 @@ class InstallProgress(object): def __init__(self): (self.statusfd, self.writefd) = os.pipe() + # These will leak fds, but fixing this safely requires API changes. self.write_stream = os.fdopen(self.writefd, "w") self.status_stream = os.fdopen(self.statusfd, "r") fcntl.fcntl(self.statusfd, fcntl.F_SETFL, os.O_NONBLOCK) - def __del__(self): - self.write_stream.close() - self.status_stream.close() - def start_update(self): """(Abstract) Start update.""" -- cgit v1.2.3