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

Andrew Svetlov report at bugs.python.org
Wed Nov 18 14:34:21 EST 2020


Andrew Svetlov <andrew.svetlov at gmail.com> added the comment:

Despite the fact that asyncio.get_running_loop() never returns None but raises RuntimeError (and maybe other tiny cleanups), 
I can live with the proposal.

It doesn't make a system worse at least and backward compatible.
We can return to the idea of raising a warning from the constructor later, on collecting more feedback.

P.S.
There is a subtle non-deterministic behavior in the proposal: if the lock is accessed from a concurrent thread, the exception about wrong usage will be raised later at an arbitrary code point.
This is a well-known problem of the lazy initialization pattern and maybe we should do nothing with it. The programming is a compromise always.

----------

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


More information about the Python-bugs-list mailing list