mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-46796: Simplify handling of removed parameter "loop" in asyncio (GH-31431)
This commit is contained in:
parent
be095f6c32
commit
195a46d6ff
4 changed files with 9 additions and 24 deletions
|
@ -5,20 +5,10 @@ from . import events
|
|||
|
||||
_global_lock = threading.Lock()
|
||||
|
||||
# Used as a sentinel for loop parameter
|
||||
_marker = object()
|
||||
|
||||
|
||||
class _LoopBoundMixin:
|
||||
_loop = None
|
||||
|
||||
def __init__(self, *, loop=_marker):
|
||||
if loop is not _marker:
|
||||
raise TypeError(
|
||||
f'As of 3.10, the *loop* parameter was removed from '
|
||||
f'{type(self).__name__}() since it is no longer necessary'
|
||||
)
|
||||
|
||||
def _get_loop(self):
|
||||
loop = events._get_running_loop()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue