Commit e5713e24 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents 112e6e0b 5fd6f07e
...@@ -532,6 +532,16 @@ Other changes ...@@ -532,6 +532,16 @@ Other changes
* Support for Python 2.6 was removed. * Support for Python 2.6 was removed.
0.29.23 (2021-??-??)
====================
Bugs fixed
----------
* Some problems with Python 3.10 were resolved.
Patches by Victor Stinner and David Woods. (Github issue #4046)
0.29.22 (2021-02-20) 0.29.22 (2021-02-20)
==================== ====================
......
...@@ -534,9 +534,9 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -534,9 +534,9 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_01(self): def test_async_gen_asyncio_01(self):
async def gen(): async def gen():
yield 1 yield 1
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
yield 2 yield 2
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
return return
yield 3 yield 3
...@@ -546,7 +546,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -546,7 +546,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_02(self): def test_async_gen_asyncio_02(self):
async def gen(): async def gen():
yield 1 yield 1
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
yield 2 yield 2
1 / ZERO 1 / ZERO
yield 3 yield 3
...@@ -560,7 +560,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -560,7 +560,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
class Gen: class Gen:
async def __aiter__(self): async def __aiter__(self):
yield 1 yield 1
await asyncio.sleep(0.01, loop=loop) await asyncio.sleep(0.01)
yield 2 yield 2
res = loop.run_until_complete(self.to_list(Gen())) res = loop.run_until_complete(self.to_list(Gen()))
...@@ -569,13 +569,13 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -569,13 +569,13 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_anext_04(self): def test_async_gen_asyncio_anext_04(self):
async def foo(): async def foo():
yield 1 yield 1
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
try: try:
yield 2 yield 2
yield 3 yield 3
except ZeroDivisionError: except ZeroDivisionError:
yield 1000 yield 1000
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
yield 4 yield 4
async def run1(): async def run1():
...@@ -726,7 +726,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -726,7 +726,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1 yield 1
1 / ZERO 1 / ZERO
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
yield 12 yield 12
async def run(): async def run():
...@@ -749,8 +749,8 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -749,8 +749,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1 yield 1
1 / ZERO 1 / ZERO
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE += 1 DONE += 1
DONE += 1000 DONE += 1000
...@@ -776,8 +776,8 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -776,8 +776,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE += 1000 DONE += 1000
yield 2 yield 2
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE += 1 DONE += 1
DONE += 1000 DONE += 1000
...@@ -792,7 +792,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -792,7 +792,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
# Silence ResourceWarnings # Silence ResourceWarnings
fut.cancel() fut.cancel()
self.loop.run_until_complete(asyncio.sleep(0.01, loop=self.loop)) self.loop.run_until_complete(asyncio.sleep(0.01))
@needs_py36_asyncio @needs_py36_asyncio
def test_async_gen_asyncio_gc_aclose_09(self): def test_async_gen_asyncio_gc_aclose_09(self):
...@@ -804,8 +804,8 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -804,8 +804,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
while True: while True:
yield 1 yield 1
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE = 1 DONE = 1
async def run(): async def run():
...@@ -814,7 +814,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -814,7 +814,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
await g.__anext__() await g.__anext__()
del g del g
await asyncio.sleep(0.2, loop=self.loop) await asyncio.sleep(0.2)
self.loop.run_until_complete(run()) self.loop.run_until_complete(run())
self.assertEqual(DONE, 1) self.assertEqual(DONE, 1)
...@@ -932,15 +932,15 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -932,15 +932,15 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen(): async def gen():
nonlocal DONE nonlocal DONE
try: try:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
v = yield 1 v = yield 1
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
yield v * 2 yield v * 2
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
return return
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE = 1 DONE = 1
async def run(): async def run():
...@@ -962,21 +962,21 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -962,21 +962,21 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE = 0 DONE = 0
async def sleep_n_crash(delay): async def sleep_n_crash(delay):
await asyncio.sleep(delay, loop=self.loop) await asyncio.sleep(delay)
1 / ZERO 1 / ZERO
async def gen(): async def gen():
nonlocal DONE nonlocal DONE
try: try:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
v = yield 1 v = yield 1
await sleep_n_crash(0.01) await sleep_n_crash(0.01)
DONE += 1000 DONE += 1000
yield v * 2 yield v * 2
finally: finally:
assert sys.exc_info()[0] == ZeroDivisionError assert sys.exc_info()[0] == ZeroDivisionError
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE += 1 DONE += 1
async def run(): async def run():
...@@ -995,7 +995,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -995,7 +995,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE = 0 DONE = 0
async def sleep_n_crash(delay): async def sleep_n_crash(delay):
fut = asyncio.ensure_future(asyncio.sleep(delay, loop=self.loop), fut = asyncio.ensure_future(asyncio.sleep(delay),
loop=self.loop) loop=self.loop)
self.loop.call_later(delay / 2, lambda: fut.cancel()) self.loop.call_later(delay / 2, lambda: fut.cancel())
return await fut return await fut
...@@ -1003,14 +1003,14 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1003,14 +1003,14 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen(): async def gen():
nonlocal DONE nonlocal DONE
try: try:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
v = yield 1 v = yield 1
await sleep_n_crash(0.01) await sleep_n_crash(0.01)
DONE += 1000 DONE += 1000
yield v * 2 yield v * 2
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE = 1 DONE = 1
async def run(): async def run():
...@@ -1049,18 +1049,18 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1049,18 +1049,18 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen(): async def gen():
nonlocal DONE nonlocal DONE
try: try:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
try: try:
v = yield 1 v = yield 1
except FooEr: except FooEr:
v = 1000 v = 1000
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
yield v * 2 yield v * 2
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
# return # return
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE = 1 DONE = 1
async def run(): async def run():
...@@ -1085,7 +1085,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1085,7 +1085,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
pass pass
async def sleep_n_crash(delay): async def sleep_n_crash(delay):
fut = asyncio.ensure_future(asyncio.sleep(delay, loop=self.loop), fut = asyncio.ensure_future(asyncio.sleep(delay),
loop=self.loop) loop=self.loop)
self.loop.call_later(delay / 2, lambda: fut.cancel()) self.loop.call_later(delay / 2, lambda: fut.cancel())
return await fut return await fut
...@@ -1093,17 +1093,17 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1093,17 +1093,17 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen(): async def gen():
nonlocal DONE nonlocal DONE
try: try:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
try: try:
v = yield 1 v = yield 1
except FooEr: except FooEr:
await sleep_n_crash(0.01) await sleep_n_crash(0.01)
yield v * 2 yield v * 2
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
# return # return
finally: finally:
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
await asyncio.sleep(0.01, loop=self.loop) await asyncio.sleep(0.01)
DONE = 1 DONE = 1
async def run(): async def run():
...@@ -1203,10 +1203,10 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1203,10 +1203,10 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def waiter(timeout): async def waiter(timeout):
nonlocal finalized nonlocal finalized
try: try:
await asyncio.sleep(timeout, loop=self.loop) await asyncio.sleep(timeout)
yield 1 yield 1
finally: finally:
await asyncio.sleep(0, loop=self.loop) await asyncio.sleep(0)
finalized += 1 finalized += 1
async def wait(): async def wait():
...@@ -1216,7 +1216,7 @@ class AsyncGenAsyncioTest(unittest.TestCase): ...@@ -1216,7 +1216,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
t1 = self.loop.create_task(wait()) t1 = self.loop.create_task(wait())
t2 = self.loop.create_task(wait()) t2 = self.loop.create_task(wait())
self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop)) self.loop.run_until_complete(asyncio.sleep(0.1))
# Silence warnings # Silence warnings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment