summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_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/base_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/base_events.py')
-rw-r--r--Lib/asyncio/base_events.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index ee13d1a..0467438 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -37,6 +37,7 @@ except ImportError: # pragma: no cover
from . import constants
from . import coroutines
from . import events
+from . import exceptions
from . import futures
from . import protocols
from . import sslproto
@@ -327,7 +328,7 @@ class Server(events.AbstractServer):
try:
await self._serving_forever_fut
- except futures.CancelledError:
+ except exceptions.CancelledError:
try:
self.close()
await self.wait_closed()
@@ -800,7 +801,7 @@ class BaseEventLoop(events.AbstractEventLoop):
try:
return await self._sock_sendfile_native(sock, file,
offset, count)
- except events.SendfileNotAvailableError as exc:
+ except exceptions.SendfileNotAvailableError as exc:
if not fallback:
raise
return await self._sock_sendfile_fallback(sock, file,
@@ -809,7 +810,7 @@ class BaseEventLoop(events.AbstractEventLoop):
async def _sock_sendfile_native(self, sock, file, offset, count):
# NB: sendfile syscall is not supported for SSL sockets and
# non-mmap files even if sendfile is supported by OS
- raise events.SendfileNotAvailableError(
+ raise exceptions.SendfileNotAvailableError(
f"syscall sendfile is not available for socket {sock!r} "
"and file {file!r} combination")
@@ -1053,7 +1054,7 @@ class BaseEventLoop(events.AbstractEventLoop):
try:
return await self._sendfile_native(transport, file,
offset, count)
- except events.SendfileNotAvailableError as exc:
+ except exceptions.SendfileNotAvailableError as exc:
if not fallback:
raise
@@ -1066,7 +1067,7 @@ class BaseEventLoop(events.AbstractEventLoop):
offset, count)
async def _sendfile_native(self, transp, file, offset, count):
- raise events.SendfileNotAvailableError(
+ raise exceptions.SendfileNotAvailableError(
"sendfile syscall is not supported")
async def _sendfile_fallback(self, transp, file, offset, count):