summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2018-09-11 17:13:04 (GMT)
committerGitHub <noreply@github.com>2018-09-11 17:13:04 (GMT)
commit0baa72f4b2e7185298d09cf64c7b591efcd22af0 (patch)
tree20ee600a314eb8f65863edca9f3c90d88cfd9a02 /Lib/asyncio/proactor_events.py
parent7c7605ff1133cf757cac428c483827f666c7c827 (diff)
downloadcpython-0baa72f4b2e7185298d09cf64c7b591efcd22af0.zip
cpython-0baa72f4b2e7185298d09cf64c7b591efcd22af0.tar.gz
cpython-0baa72f4b2e7185298d09cf64c7b591efcd22af0.tar.bz2
bpo-34622: Extract asyncio exceptions into a separate module (GH-9141)
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 66bfb0a..ad23918 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -15,6 +15,7 @@ from . import base_events
from . import constants
from . import events
from . import futures
+from . import exceptions
from . import protocols
from . import sslproto
from . import transports
@@ -282,7 +283,7 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport,
self._force_close(exc)
except OSError as exc:
self._fatal_error(exc, 'Fatal read error on pipe transport')
- except futures.CancelledError:
+ except exceptions.CancelledError:
if not self._closing:
raise
else:
@@ -555,11 +556,11 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
try:
fileno = file.fileno()
except (AttributeError, io.UnsupportedOperation) as err:
- raise events.SendfileNotAvailableError("not a regular file")
+ raise exceptions.SendfileNotAvailableError("not a regular file")
try:
fsize = os.fstat(fileno).st_size
except OSError as err:
- raise events.SendfileNotAvailableError("not a regular file")
+ raise exceptions.SendfileNotAvailableError("not a regular file")
blocksize = count if count else fsize
if not blocksize:
return 0 # empty file
@@ -615,7 +616,7 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
if f is not None:
f.result() # may raise
f = self._proactor.recv(self._ssock, 4096)
- except futures.CancelledError:
+ except exceptions.CancelledError:
# _close_self_pipe() has been called, stop waiting for data
return
except Exception as exc:
@@ -666,7 +667,7 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
elif self._debug:
logger.debug("Accept failed on socket %r",
sock, exc_info=True)
- except futures.CancelledError:
+ except exceptions.CancelledError:
sock.close()
else:
self._accept_futures[sock.fileno()] = f