Skip to content

Commit c277db5

Browse files
authored
Merge pull request #49 from tannewt/1.20-fixes
1.20 fixes
2 parents 723b428 + 84c73c6 commit c277db5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

asyncio/funcs.py

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ async def gather(*aws, return_exceptions=False):
9898
9999
Returns a list of return values of all *aws*
100100
"""
101+
if not aws:
102+
return []
103+
101104
def done(t, er):
102105
# Sub-task "t" has finished, with exception "er".
103106
nonlocal state

asyncio/stream.py

+7
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ def write(self, buf):
113113
`Stream.drain` is called. It is recommended to call `Stream.drain`
114114
immediately after calling this function.
115115
"""
116+
if not self.out_buf:
117+
# Try to write immediately to the underlying stream.
118+
ret = self.s.write(buf)
119+
if ret == len(buf):
120+
return
121+
if ret is not None:
122+
buf = buf[ret:]
116123

117124
self.out_buf += buf
118125

0 commit comments

Comments
 (0)