[New-bugs-announce] [issue46796] Simplify handling of removed parameter "loop" in asyncio

Serhiy Storchaka report at bugs.python.org
Sat Feb 19 02:56:05 EST 2022

New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

Before 3.10 many asyncio classes did have an optional parameter "loop". It was deprecated in 3.8. To simplify the code, such classes inherited a constructor from _LoopBoundMixin which set the _loop attribute and (since 3.8) emitted a warning if the loop argument was passed. Since 3.10 the _LoopBoundMixin no longer sets the _loop attribute and always raises a TypeError if the loop argument is passed.

The same effect can be achieved if just remove the loop parameter (and the _LoopBoundMixin constructor as it will do nothing). The only difference in the error message: it will be standard "Lock.__init__() got an unexpected keyword argument 'loop'" instead of "As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary". Usually we do not keep specialized error messages for removed parameters.

components: asyncio
messages: 413539
nosy: asvetlov, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Simplify handling of removed parameter "loop" in asyncio
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list