Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion 18 Lib/ldap/ldapobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@

from ldap import LDAPError

from errno import EINTR

def _retry_if_interrupted(func, *args, **kwargs):
"""Call func, retrying if it raises an LDAPError with errno == EINTR.
"""

while True:
try:
return func(*args, **kwargs)
except LDAPError as e:
try:
if e.args[0]['errno'] != EINTR:
raise
except (AttributeError, IndexError, KeyError):
raise e

PY2 = sys.version_info[0] <= 2
if PY2:
text_type = unicode
Expand Down Expand Up @@ -312,7 +328,7 @@ def _ldap_call(self,func,*args,**kwargs):
diagnostic_message_success = None
try:
try:
result = func(*args,**kwargs)
result = _retry_if_interrupted(func, *args, **kwargs)
if __debug__ and self._trace_level>=2:
if func.__name__!="unbind_ext":
diagnostic_message_success = self._l.get_option(ldap.OPT_DIAGNOSTIC_MESSAGE)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.