Closed malthe closed 6 years ago
Note that this issue only appears to occur in Python 2 (or, at least, Python 3.6 re-raises the original exception, not the last one).
It seems like there are two possible fixes here:
Rewrite the offending if 'info'...
line to check that len(args) > 0
(or something as simple as if e.args and 'info' not in ...
), and then remove the try
/ except
.
Adopt/adapt the upstream fix, but update for Python 3.
Python 3's raise
syntax is different, and the Python 2 syntax will raise a SyntaxError
even if you condition it on the Python version. The ideal way to do that would be to have pyldap add a dependency on six and just use six.reraise.
I'll adapt upstream fix as soon as I get to merging python-ldap 2.4.45.
In case an
IndexError
is raised_ldap_call
, the current logic does not re-raise theLDAPError
but instead theIndexError
breaking expectations further up.See d8ac99c3c376ab6d3379b233acb7747db8dedd4f.