Skip to content

Commit

Permalink
Merge pull request #49 from tannewt/1.20-fixes
Browse files Browse the repository at this point in the history
1.20 fixes
  • Loading branch information
dhalbert committed Oct 12, 2023
2 parents 723b428 + 84c73c6 commit c277db5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions asyncio/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions asyncio/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c277db5

Please sign in to comment.