forked from fedora-python/python26
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python-2.6.6-fix-EINTR-check-for-nonstandard-exceptions.patch
61 lines (58 loc) · 2.34 KB
/
python-2.6.6-fix-EINTR-check-for-nonstandard-exceptions.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff -up Python-2.6.6/Lib/socket.py.fix-EINTR-check-for-nonstandard-exceptions Python-2.6.6/Lib/socket.py
--- Python-2.6.6/Lib/socket.py.fix-EINTR-check-for-nonstandard-exceptions 2011-03-04 17:35:36.425676635 -0500
+++ Python-2.6.6/Lib/socket.py 2011-03-04 17:37:50.894540249 -0500
@@ -223,6 +223,12 @@ class _socketobject(object):
socket = SocketType = _socketobject
+def _exception_was_EINTR(exc):
+ if len(exc.args) > 0:
+ if exc.args[0] == EINTR:
+ return 1
+ return 0
+
class _fileobject(object):
"""Faux file object attached to a socket object."""
@@ -347,7 +353,7 @@ class _fileobject(object):
try:
data = self._sock.recv(rbufsize)
except error, e:
- if e.args[0] == EINTR:
+ if _exception_was_EINTR(e):
continue
raise
if not data:
@@ -376,7 +382,7 @@ class _fileobject(object):
try:
data = self._sock.recv(left)
except error, e:
- if e.args[0] == EINTR:
+ if _exception_was_EINTR(e):
continue
raise
if not data:
@@ -431,7 +437,7 @@ class _fileobject(object):
except error, e:
# The try..except to catch EINTR was moved outside the
# recv loop to avoid the per byte overhead.
- if e.args[0] == EINTR:
+ if _exception_was_EINTR(e):
continue
raise
break
@@ -443,7 +449,7 @@ class _fileobject(object):
try:
data = self._sock.recv(self._rbufsize)
except error, e:
- if e.args[0] == EINTR:
+ if _exception_was_EINTR(e):
continue
raise
if not data:
@@ -472,7 +478,7 @@ class _fileobject(object):
try:
data = self._sock.recv(self._rbufsize)
except error, e:
- if e.args[0] == EINTR:
+ if _exception_was_EINTR(e):
continue
raise
if not data: