From db01767acf4cb002995a3609061a45ca90cde573 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Fri, 2 Jun 2017 14:57:29 +0200 Subject: [PATCH] py3: LDAPClient: remove __del__ method in py3 we are receiving ugly tracebacks due __del__ method that should be used very carefully or never. Due tracebacks, this doesn't work and context manager should be used for reliable connection termination. Exception ignored in: Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/ipapython/ipaldap.py", line 1057, in __del__ File "/usr/lib/python3.5/site-packages/ipaserver/plugins/ldap2.py", line 123, in close File "/usr/lib/python3.5/site-packages/ipalib/backend.py", line 94, in isconnected NameError: name 'hasattr' is not defined Reviewed-By: Stanislav Laznicka --- ipapython/ipaldap.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index f4f4bc531..b9fcf5109 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -1054,9 +1054,6 @@ class LDAPClient(object): reason=_('objectclass %s not found') % oc) return [unicode(a).lower() for a in list(set(allowed_attributes))] - def __del__(self): - self.close() - def __enter__(self): return self