[3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep()#27569
[3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep()#27569ambv merged 8 commits intopython:3.9from
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
A change in gather() LGTM, but useless get_running_loop() is called for sleep(0). I suggest to change the code in the same way as in gather():
if loop is not None:
warnings.warn(...)
if delay <= 0:
...
if loop is None:
...
It will add smaller overhead.
|
Serhiy is right, and additionally we need to silence all the new warnings in |
How was it solved in 3.10? If the corresponding test code (for loop is not None) was just removed or wrapped with |
The deprecations reached their EOL and functionality was removed. But it's a problem that will return so I think it's worth approaching systematically. We will need something like GH-27634 to do it. |
Additional improvements: - messages which were compiled regular expressions aren't unpacked back into strings for unmatched warnings; - removed unnecessary "if tokens:" check (there's one before the for loop).
|
I think this has introduced an unavoidable deprecation warning in https://github.com/python/cpython/blob/v3.9.7/Lib/asyncio/base_events.py#L1514-L1518 if start_serving:
server._start_serving()
# Skip one loop iteration so that all 'loop.add_reader'
# go through.
await tasks.sleep(0, loop=self)It also appears to affect https://github.com/python/cpython/blob/v3.9.7/Lib/asyncio/base_events.py#L349-L353 async def start_serving(self):
self._start_serving()
# Skip one loop iteration so that all 'loop.add_reader'
# go through.
await tasks.sleep(0, loop=self._loop)Edit: Late update, this new failure was also reported as https://bugs.python.org/issue45097 and fixed in 3.9.8. |
https://bugs.python.org/issue44815