Skip to content

Instantly share code, notes, and snippets.

@simlun
Created March 16, 2013 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simlun/5178295 to your computer and use it in GitHub Desktop.
Save simlun/5178295 to your computer and use it in GitHub Desktop.
socket recv's may raise EAGAIN, unlike any other platform Fix for recognizing gdbm 1.9.x databases; already upstream: http://hg.python.org/cpython/rev/14cafb8d1480
diff --git a/Lib/socket.py b/Lib/socket.py
index bd364e7..fd432f6 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -92,6 +92,7 @@ except ImportError:
errno = None
EBADF = getattr(errno, 'EBADF', 9)
EINTR = getattr(errno, 'EINTR', 4)
+EAGAIN = getattr(errno, 'EAGAIN', 35)
__all__ = ["getfqdn", "create_connection"]
__all__.extend(os._get_exports_list(_socket))
@@ -446,7 +447,7 @@ class _fileobject(object):
try:
data = self._sock.recv(self._rbufsize)
except error, e:
- if e.args[0] == EINTR:
+ if e.args[0] in (EINTR, EAGAIN):
continue
raise
if not data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment