From 84c73c6a396ee462bf68f6ade1ae547a96269780 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 6 Oct 2023 13:21:10 -0700 Subject: [PATCH] Two asyncio changes that fix tests --- asyncio/funcs.py | 3 +++ asyncio/stream.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/asyncio/funcs.py b/asyncio/funcs.py index baf804d..b1bb24a 100644 --- a/asyncio/funcs.py +++ b/asyncio/funcs.py @@ -98,6 +98,9 @@ async def gather(*aws, return_exceptions=False): Returns a list of return values of all *aws* """ + if not aws: + return [] + def done(t, er): # Sub-task "t" has finished, with exception "er". nonlocal state diff --git a/asyncio/stream.py b/asyncio/stream.py index 4a9d6bf..44a8cc5 100644 --- a/asyncio/stream.py +++ b/asyncio/stream.py @@ -113,6 +113,13 @@ def write(self, buf): `Stream.drain` is called. It is recommended to call `Stream.drain` immediately after calling this function. """ + if not self.out_buf: + # Try to write immediately to the underlying stream. + ret = self.s.write(buf) + if ret == len(buf): + return + if ret is not None: + buf = buf[ret:] self.out_buf += buf pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy