summaryrefslogtreecommitdiff
path: root/Lib/asyncio/base_events.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2018-01-19 20:04:29 +0200
committerGitHub <noreply@github.com>2018-01-19 20:04:29 +0200
commit7464e87a6511d3626b04c9833a262a77b1f21e23 (patch)
tree4d7bc17260536bd3d91902b521cbf30957cdc1c8 /Lib/asyncio/base_events.py
parent2507e29a9e4e9dcac6eab46546bd3d34a69342ba (diff)
downloadcpython-git-7464e87a6511d3626b04c9833a262a77b1f21e23.tar.gz
bpo-32410: Make SendfileNotAvailableError exception public (#5243)
Diffstat (limited to 'Lib/asyncio/base_events.py')
-rw-r--r--Lib/asyncio/base_events.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index b6a9384d95..00c84a835c 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -154,10 +154,6 @@ def _run_until_complete_cb(fut):
futures._get_loop(fut).stop()
-class _SendfileNotAvailable(RuntimeError):
- pass
-
-
class Server(events.AbstractServer):
def __init__(self, loop, sockets):
@@ -659,17 +655,16 @@ class BaseEventLoop(events.AbstractEventLoop):
try:
return await self._sock_sendfile_native(sock, file,
offset, count)
- except _SendfileNotAvailable as exc:
- if fallback:
- return await self._sock_sendfile_fallback(sock, file,
- offset, count)
- else:
- raise RuntimeError(exc.args[0]) from None
+ except events.SendfileNotAvailableError as exc:
+ if not fallback:
+ raise
+ return await self._sock_sendfile_fallback(sock, file,
+ offset, count)
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 _SendfileNotAvailable(
+ raise events.SendfileNotAvailableError(
f"syscall sendfile is not available for socket {sock!r} "
"and file {file!r} combination")