-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
[3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep() #27569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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