From 50b28369a82f0e4965ec8e5f8ca2eb7fe6093356 Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Tue, 3 Dec 2013 22:19:37 -0500 Subject: [PATCH] Revert "Ensure connections are properly closed on object destruction" (#291) This reverts commit 1922ddac389270301e40a0589127cb87262f7cad. Fixes #292. --- urllib3/_collections.py | 3 --- urllib3/connectionpool.py | 3 --- urllib3/poolmanager.py | 3 --- 3 files changed, 9 deletions(-) diff --git a/urllib3/_collections.py b/urllib3/_collections.py index ff4316cce9..5907b0dc7c 100644 --- a/urllib3/_collections.py +++ b/urllib3/_collections.py @@ -51,9 +51,6 @@ def __init__(self, maxsize=10, dispose_func=None): self._container = self.ContainerCls() self.lock = RLock() - def __del__(self): - self.clear() - def __getitem__(self, key): # Re-insert the item, moving it to the end of the eviction line. with self.lock: diff --git a/urllib3/connectionpool.py b/urllib3/connectionpool.py index 8f45c73704..72011b5a33 100644 --- a/urllib3/connectionpool.py +++ b/urllib3/connectionpool.py @@ -167,9 +167,6 @@ def __init__(self, host, port=None, strict=False, self.num_connections = 0 self.num_requests = 0 - def __del__(self): - self.close() - def _new_conn(self): """ Return a fresh :class:`httplib.HTTPConnection`. diff --git a/urllib3/poolmanager.py b/urllib3/poolmanager.py index ccf18a31fe..c16519f883 100644 --- a/urllib3/poolmanager.py +++ b/urllib3/poolmanager.py @@ -68,9 +68,6 @@ def __init__(self, num_pools=10, headers=None, **connection_pool_kw): self.pools = RecentlyUsedContainer(num_pools, dispose_func=lambda p: p.close()) - def __del__(self): - self.clear() - def _new_pool(self, scheme, host, port): """ Create a new :class:`ConnectionPool` based on host, port and scheme.