summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-23 21:49:42 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-23 21:49:42 (GMT)
commit24d659daafd0e6c1514ee912f06f7b7310545e09 (patch)
treedfde423cd56334b8e85e8778b491f928d6a2c20b /Lib/_pyio.py
parentdcbb822c08e75dbb45afe1c435af95961f22387a (diff)
downloadcpython-24d659daafd0e6c1514ee912f06f7b7310545e09.zip
cpython-24d659daafd0e6c1514ee912f06f7b7310545e09.tar.gz
cpython-24d659daafd0e6c1514ee912f06f7b7310545e09.tar.bz2
Use InterruptedError instead of checking for EINTR
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 0611bd6..3bd35d2 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -14,7 +14,6 @@ except ImportError:
import io
from io import (__all__, SEEK_SET, SEEK_CUR, SEEK_END)
-from errno import EINTR
# open() uses st_blksize whenever we can
DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes
@@ -948,9 +947,7 @@ class BufferedReader(_BufferedIOMixin):
# Read until EOF or until read() would block.
try:
chunk = self.raw.read()
- except IOError as e:
- if e.errno != EINTR:
- raise
+ except InterruptedError:
continue
if chunk in empty_values:
nodata_val = chunk
@@ -972,9 +969,7 @@ class BufferedReader(_BufferedIOMixin):
while avail < n:
try:
chunk = self.raw.read(wanted)
- except IOError as e:
- if e.errno != EINTR:
- raise
+ except InterruptedError:
continue
if chunk in empty_values:
nodata_val = chunk
@@ -1007,9 +1002,7 @@ class BufferedReader(_BufferedIOMixin):
while True:
try:
current = self.raw.read(to_read)
- except IOError as e:
- if e.errno != EINTR:
- raise
+ except InterruptedError:
continue
break
if current:
@@ -1120,9 +1113,7 @@ class BufferedWriter(_BufferedIOMixin):
while self._write_buf:
try:
n = self.raw.write(self._write_buf)
- except IOError as e:
- if e.errno != EINTR:
- raise
+ except InterruptedError:
continue
if n > len(self._write_buf) or n < 0:
raise IOError("write() returned incorrect number of bytes")