Skip to content

Instantly share code, notes, and snippets.

@simlun

simlun/diff

Created Mar 16, 2013
Embed
What would you like to do?
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