From 1800cf615df2a0ccfce5aa787690385d7f562650 Mon Sep 17 00:00:00 2001 From: stroeder Date: Thu, 27 Apr 2017 08:40:10 +0000 Subject: [PATCH] fixed errno-related regression introduced in 2.4.35 --- CHANGES | 4 +++- Lib/ldap/ldapobject.py | 11 +++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index d3a9235..d4a5318 100644 --- a/CHANGES +++ b/CHANGES @@ -4,10 +4,12 @@ Released 2.4.37 2017-05-xx Changes since 2.4.36: Lib/ +* fixed errno-related regression introduced in 2.4.35 Tests/ * added more checks to t_cext.py * renamed t_search.py to t_ldapobject.py and code-cleaning +* added test for errno-related regression to t_ldapobject.py ---------------------------------------------------------------- Released 2.4.36 2017-04-26 @@ -1407,4 +1409,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.433 2017/04/27 08:27:33 stroeder Exp $ +$Id: CHANGES,v 1.434 2017/04/27 08:40:10 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index 40606c0..ae52733 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.161 2017/04/25 17:50:33 stroeder Exp $ +\$Id: ldapobject.py,v 1.162 2017/04/27 08:40:10 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -111,13 +111,8 @@ def _ldap_call(self,func,*args,**kwargs): diagnostic_message_success = self._l.get_option(ldap.OPT_DIAGNOSTIC_MESSAGE) finally: self._ldap_object_lock.release() - except LDAPError,e: - if 'info' not in e.args[0]: - try: - errno = e.args[0]['errno'] - except KeyError: - pass - else: + except LDAPError, e: + if not e.args[0].has_key('info') and e.args[0].has_key('errno'): 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)))