diff --git a/CHANGES b/CHANGES index 51dc96d..2be9953 100644 --- a/CHANGES +++ b/CHANGES @@ -4,9 +4,12 @@ Released 2.4.28 2016-11-17 Changes since 2.4.27: Lib/ +* LDAPObject.unbind_ext_s() invokes LDAPObject._trace_file.flush() + only if LDAPObject._trace_level is non-zero and Python is running + in debug mode * LDAPObject.unbind_ext_s() now ignores AttributeError - in case _trace_file has no flush() method -* added dummy method logging_file_class.flush() because + in case LDAPObject._trace_file has no flush() method +* added dummy method ldap.logger.logging_file_class.flush() because LDAPObject.unbind_ext_s() invokes it ---------------------------------------------------------------- @@ -1293,4 +1296,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.397 2016/11/17 12:08:59 stroeder Exp $ +$Id: CHANGES,v 1.398 2016/11/18 07:01:45 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index 9b87787..188405c 100644 --- a/Lib/ldap/ldapobject.py +++ b/Lib/ldap/ldapobject.py @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -\$Id: ldapobject.py,v 1.157 2016/11/17 12:08:30 stroeder Exp $ +\$Id: ldapobject.py,v 1.158 2016/11/18 07:01:45 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -636,10 +636,11 @@ def unbind_ext_s(self,serverctrls=None,clientctrls=None): result = self.result3(msgid,all=1,timeout=self.timeout) else: result = None - try: - self._trace_file.flush() - except AttributeError: - pass + if __debug__ and self._trace_level>=1: + try: + self._trace_file.flush() + except AttributeError: + pass return result def unbind(self):