mirror of
https://github.com/python/cpython.git
synced 2025-08-08 10:58:51 +00:00
[3.12] gh-113538: Don't error in stream reader protocol callback when task is cancelled (GH-113690) (#113713)
(cherry picked from commit 4681a5271a
)
Co-authored-by: Guido van Rossum <guido@python.org>
This commit is contained in:
parent
d3f2051eec
commit
92ba4e10fa
3 changed files with 21 additions and 7 deletions
|
@ -246,6 +246,9 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
|
|||
self._stream_writer)
|
||||
if coroutines.iscoroutine(res):
|
||||
def callback(task):
|
||||
if task.cancelled():
|
||||
transport.close()
|
||||
return
|
||||
exc = task.exception()
|
||||
if exc is not None:
|
||||
self._loop.call_exception_handler({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue