[issue42392] remove the 'loop' parameter from __init__ in all classes in asyncio.locks

Yury Selivanov report at bugs.python.org
Tue Nov 17 18:40:08 EST 2020


Yury Selivanov <yselivanov at gmail.com> added the comment:

Oh my.  FWIW I think that we need to implement this differently. I don't think it matters where, say, an asyncio.Lock was instantiated. It can be created anywhere. So IMO its __init__ shouldn't try to capture the current loop -- there's no need for that. The loop can be and should be captured when the first `await lock.acquire()` is called.

I'm writing a piece of code right now that would need to jump through the hoops to simply create a new `asyncio.Lock()` in a place where there's no asyncio loop yet.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42392>
_______________________________________


More information about the Python-bugs-list mailing list