summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-25 14:47:37 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-25 14:47:37 (GMT)
commitf7a17b48d748e1835bcf9df86fb7fb318bb020f8 (patch)
tree403d91c57f72d6e538ce09a8037bd658bc619760 /Lib/multiprocessing
parent16bdd4120d8452e8e04b124bcdd116608c5166b0 (diff)
downloadcpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.zip
cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.tar.gz
cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.tar.bz2
Replace IOError with OSError (#16715)
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/connection.py14
-rw-r--r--Lib/multiprocessing/managers.py2
-rw-r--r--Lib/multiprocessing/pool.py20
3 files changed, 18 insertions, 18 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index 391d6b2..8b2be19 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -132,22 +132,22 @@ class _ConnectionBase:
def _check_closed(self):
if self._handle is None:
- raise IOError("handle is closed")
+ raise OSError("handle is closed")
def _check_readable(self):
if not self._readable:
- raise IOError("connection is write-only")
+ raise OSError("connection is write-only")
def _check_writable(self):
if not self._writable:
- raise IOError("connection is read-only")
+ raise OSError("connection is read-only")
def _bad_message_length(self):
if self._writable:
self._readable = False
else:
self.close()
- raise IOError("bad message length")
+ raise OSError("bad message length")
@property
def closed(self):
@@ -317,7 +317,7 @@ if _winapi:
return f
elif err == _winapi.ERROR_MORE_DATA:
return self._get_more_data(ov, maxsize)
- except IOError as e:
+ except OSError as e:
if e.winerror == _winapi.ERROR_BROKEN_PIPE:
raise EOFError
else:
@@ -383,7 +383,7 @@ class Connection(_ConnectionBase):
if remaining == size:
raise EOFError
else:
- raise IOError("got end of file during message")
+ raise OSError("got end of file during message")
buf.write(chunk)
remaining -= n
return buf
@@ -443,7 +443,7 @@ class Listener(object):
Returns a `Connection` object.
'''
if self._listener is None:
- raise IOError('listener is closed')
+ raise OSError('listener is closed')
c = self._listener.accept()
if self._authkey:
deliver_challenge(c, self._authkey)
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py
index 1ab147e..30ef771 100644
--- a/Lib/multiprocessing/managers.py
+++ b/Lib/multiprocessing/managers.py
@@ -167,7 +167,7 @@ class Server(object):
while True:
try:
c = self.listener.accept()
- except (OSError, IOError):
+ except OSError:
continue
t = threading.Thread(target=self.handle_request, args=(c,))
t.daemon = True
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 7f73b44..c0aa717 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -78,8 +78,8 @@ def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None):
while maxtasks is None or (maxtasks and completed < maxtasks):
try:
task = get()
- except (EOFError, IOError):
- debug('worker got EOFError or IOError -- exiting')
+ except (EOFError, OSError):
+ debug('worker got EOFError or OSError -- exiting')
break
if task is None:
@@ -349,7 +349,7 @@ class Pool(object):
break
try:
put(task)
- except IOError:
+ except OSError:
debug('could not put task on queue')
break
else:
@@ -371,8 +371,8 @@ class Pool(object):
debug('task handler sending sentinel to workers')
for p in pool:
put(None)
- except IOError:
- debug('task handler got IOError when sending sentinels')
+ except OSError:
+ debug('task handler got OSError when sending sentinels')
debug('task handler exiting')
@@ -383,8 +383,8 @@ class Pool(object):
while 1:
try:
task = get()
- except (IOError, EOFError):
- debug('result handler got EOFError/IOError -- exiting')
+ except (OSError, EOFError):
+ debug('result handler got EOFError/OSError -- exiting')
return
if thread._state:
@@ -405,8 +405,8 @@ class Pool(object):
while cache and thread._state != TERMINATE:
try:
task = get()
- except (IOError, EOFError):
- debug('result handler got EOFError/IOError -- exiting')
+ except (OSError, EOFError):
+ debug('result handler got EOFError/OSError -- exiting')
return
if task is None:
@@ -428,7 +428,7 @@ class Pool(object):
if not outqueue._reader.poll():
break
get()
- except (IOError, EOFError):
+ except (OSError, EOFError):
pass
debug('result handler exiting: len(cache)=%s, thread._state=%s',