diff --git a/CHANGES b/CHANGES index 9a558f9..98173d9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ +---------------------------------------------------------------- +Released 2.4.36 2017-04-26 + +Changes since 2.4.35: + +Lib/ +* gracefully handle KeyError in LDAPObject._ldap_call() when + using errno + ---------------------------------------------------------------- Released 2.4.35 2017-04-25 @@ -1374,4 +1383,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.423 2017/04/25 17:42:00 stroeder Exp $ +$Id: CHANGES,v 1.424 2017/04/25 17:50:33 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index a87538a..40606c0 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.160 2017/04/25 13:40:52 stroeder Exp $ +\$Id: ldapobject.py,v 1.161 2017/04/25 17:50:33 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -113,7 +113,12 @@ def _ldap_call(self,func,*args,**kwargs): self._ldap_object_lock.release() except LDAPError,e: if 'info' not in e.args[0]: - e.args[0]['info'] = strerror(e.args[0]['errno']) + try: + errno = e.args[0]['errno'] + except KeyError: + pass + else: + e.args[0]['info'] = strerror(e.args[0]['errno']) if __debug__ and self._trace_level>=2: self._trace_file.write('=> LDAPError - %s: %s\n' % (e.__class__.__name__,str(e))) raise