summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/unix_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/unix_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/unix_events.py')
-rw-r--r--Lib/asyncio/unix_events.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 7cad7e3..1a62db4 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -18,6 +18,7 @@ from . import base_subprocess
from . import constants
from . import coroutines
from . import events
+from . import exceptions
from . import futures
from . import selector_events
from . import tasks
@@ -319,16 +320,16 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
try:
os.sendfile
except AttributeError as exc:
- raise events.SendfileNotAvailableError(
+ raise exceptions.SendfileNotAvailableError(
"os.sendfile() is not available")
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
@@ -382,7 +383,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
# one being 'file' is not a regular mmap(2)-like
# file, in which case we'll fall back on using
# plain send().
- err = events.SendfileNotAvailableError(
+ err = exceptions.SendfileNotAvailableError(
"os.sendfile call failed")
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
fut.set_exception(err)