Skip to content

Commit

Permalink
Fixed reraising of wrong exception in SimpleLDAPObject._ldap_call()
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Oct 9, 2017
1 parent 206a10b commit ec9703b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Released 2.4.45 2017-09-xx
Changes since 2.4.44:

Lib/
* Fixed reraising of wrong exception in SimpleLDAPObject._ldap_call()
(thanks to Aigars Grins)

Tests/
* removed work-around in t_cext.py
Expand Down Expand Up @@ -1511,4 +1513,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19

$Id: CHANGES,v 1.468 2017/10/09 14:40:48 stroeder Exp $
$Id: CHANGES,v 1.469 2017/10/09 14:54:10 stroeder Exp $
5 changes: 3 additions & 2 deletions Lib/ldap/ldapobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See https://www.python-ldap.org/ for details.
\$Id: ldapobject.py,v 1.165 2017/09/04 14:59:12 stroeder Exp $
\$Id: ldapobject.py,v 1.166 2017/10/09 14:54:10 stroeder Exp $
Compability:
- Tested with Python 2.0+ but should work with Python 1.5.x
Expand Down Expand Up @@ -112,14 +112,15 @@ def _ldap_call(self,func,*args,**kwargs):
finally:
self._ldap_object_lock.release()
except LDAPError, e:
exc_type,exc_value,exc_traceback = sys.exc_info()
try:
if not e.args[0].has_key('info') and e.args[0].has_key('errno'):
e.args[0]['info'] = strerror(e.args[0]['errno'])
except IndexError:
pass
if __debug__ and self._trace_level>=2:
self._trace_file.write('=> LDAPError - %s: %s\n' % (e.__class__.__name__,str(e)))
raise
raise exc_type,exc_value,exc_traceback
else:
if __debug__ and self._trace_level>=2:
if not diagnostic_message_success is None:
Expand Down

0 comments on commit ec9703b

Please sign in to comment.