Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

[2.0] Explicit loop parameters are deprecated #1002

Closed
bmerry opened this issue Jun 8, 2021 · 1 comment
Closed

[2.0] Explicit loop parameters are deprecated #1002

bmerry opened this issue Jun 8, 2021 · 1 comment

Comments

@bmerry
Copy link
Collaborator

bmerry commented Jun 8, 2021

The new 2.0 implementation has a number of places where it either takes an explicit loop parameter, or passes one to an asyncio function. The need for this was largely removed in Python 3.5.3 (because get_event_loop was changed to return the event loop of the current task when called from inside a task), and many functions (such as wait_for deprecated the parameter in 3.8 with removal for 3.10. Other functions (like open_connection) didn't deprecate it, but made it optional and documented that it is not needed when called from a coroutine. I wouldn't be surprised if they are deprecated in future.

I would suggest:
(a) eliminating passing the parameter where it is deprecated e.g. wait_for
(b) eliminating passing the parameter where it is unnecessary
(c) eliminating the loop argument to the Connection constructor and the _loop attribute. The finalizer currently uses it, but I've argued in #930 that this is a bad idea.

Let me know if a PR is likely to be looked at.

@Andrew-Chen-Wang
Copy link
Collaborator

@bmerry Do it! (asyncio is an evolving lib so yea go for it!)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants