[python-ldap] syncrepl_poll timeout causing extra IndexError exception
Michael Ströder
michael at stroeder.com
Mon May 29 04:38:56 EDT 2017
Karl Kornel wrote:
> I would like to report a syncrepl-related issue with python-ldap 2.4.38, running in
> Python 2.7.13, on Mac OS X. The OpenLDAP library is 2.4.44. It seems like the
> `timeout` parameter in syncrepl_poll() is causing an unexpected exception (that is,
> not a timeout).
Sigh … the inconsistent exception raising really sucks.
Was the ldap.TIMEOUT caused by a syncrepl provider not reachable in time?
Could you come up with a simple test code showing the problem?
Ideally as patch to Tests/t_ldapobject.py.
Could you please test whether the patch attached below solves this?
(It simply masks the IndexError probably raised by e.args[0] not fully populated for the
ldap.TIMEOUT exception.)
Ciao, Michael.
Index: Lib/ldap/ldapobject.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/ldapobject.py,v
retrieving revision 1.162
diff -u -r1.162 ldapobject.py
--- Lib/ldap/ldapobject.py 27 Apr 2017 08:40:10 -0000 1.162
+++ Lib/ldap/ldapobject.py 29 May 2017 08:34:10 -0000
@@ -112,8 +112,11 @@
finally:
self._ldap_object_lock.release()
except LDAPError, e:
- if not e.args[0].has_key('info') and e.args[0].has_key('errno'):
+ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3829 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20170529/801632ff/attachment.bin>
More information about the python-ldap
mailing list