bpo-32622: Enforce sendfile fallback policy for FALLBACK transports (#5364)

This commit is contained in:
Yury Selivanov 2018-01-27 15:52:52 -05:00 committed by GitHub
parent 7c684073f9
commit b1a6ac4c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -1035,7 +1035,12 @@ class BaseEventLoop(events.AbstractEventLoop):
except events.SendfileNotAvailableError as exc:
if not fallback:
raise
# the mode is FALLBACK or fallback is True
if not fallback:
raise RuntimeError(
f"fallback is disabled and native sendfile is not "
f"supported for transport {transport!r}")
return await self._sendfile_fallback(transport, file,
offset, count)