diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-15 04:27:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 04:27:10 -0700 |
commit | 5e97450d83d4f4240315f46419686ec193273e13 (patch) | |
tree | 122abd26234a2e622a8da3a40ae65555174f6146 | |
parent | 0b592d513b073cd3a4ba7632907c25b8282f15ce (diff) | |
download | cpython-git-5e97450d83d4f4240315f46419686ec193273e13.tar.gz |
Use threadpool for reading from file in sendfile fallback mode (GH-14076)
(cherry picked from commit 0237265e8287141c40faa8719da3a2d21d511d0d)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
-rw-r--r-- | Lib/asyncio/base_events.py | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index a736d01d6f..a9660ca108 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -1078,7 +1078,7 @@ class BaseEventLoop(events.AbstractEventLoop): if blocksize <= 0: return total_sent view = memoryview(buf)[:blocksize] - read = file.readinto(view) + read = await self.run_in_executor(None, file.readinto, view) if not read: return total_sent # EOF await proto.drain() diff --git a/Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst b/Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst new file mode 100644 index 0000000000..7cdc56a72c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-06-14-13-30-47.bpo-37280.Fxur0F.rst @@ -0,0 +1 @@ +Use threadpool for reading from file for sendfile fallback mode. |