Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b1a6ac4c
Commit
b1a6ac4c
authored
Jan 27, 2018
by
Yury Selivanov
Committed by
GitHub
Jan 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-32622: Enforce sendfile fallback policy for FALLBACK transports (#5364)
parent
7c684073
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
Lib/asyncio/base_events.py
Lib/asyncio/base_events.py
+6
-1
Lib/test/test_asyncio/test_events.py
Lib/test/test_asyncio/test_events.py
+9
-0
No files found.
Lib/asyncio/base_events.py
View file @
b1a6ac4c
...
...
@@ -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
)
...
...
Lib/test/test_asyncio/test_events.py
View file @
b1a6ac4c
...
...
@@ -27,6 +27,7 @@ if sys.platform != 'win32':
import
asyncio
from
asyncio
import
base_events
from
asyncio
import
constants
from
asyncio
import
coroutines
from
asyncio
import
events
from
asyncio
import
proactor_events
...
...
@@ -2381,6 +2382,14 @@ class SendfileMixin:
ret
=
self
.
run_loop
(
t
)
self
.
assertEqual
(
ret
,
len
(
self
.
DATA
))
def
test_sendfile_no_fallback_for_fallback_transport
(
self
):
transport
=
mock
.
Mock
()
transport
.
is_closing
.
side_effect
=
lambda
:
False
transport
.
_sendfile_compatible
=
constants
.
_SendfileMode
.
FALLBACK
with
self
.
assertRaisesRegex
(
RuntimeError
,
'fallback is disabled'
):
self
.
loop
.
run_until_complete
(
self
.
loop
.
sendfile
(
transport
,
None
,
fallback
=
False
))
if
sys
.
platform
==
'win32'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment