On 11. 11. 21 13:31, Victor Stinner wrote:
The asyncore module is a very old module of the Python stdlib for asynchronous programming, usually to handle network sockets concurrently. It's a common event loop, but its design has many flaws.
The asyncio module was added to Python 3.4 with a well designed architecture. Twisted developers, who have like 10 to 20 years of experience in asynchronous programming, helped to design the asyncio API. By design, asyncio doesn't have flaws which would be really hard to fix in asyncore and asynchat.
It was decided to start deprecating the asyncore, asynchat and smtpd modules in Python 3.6 released in 2016, 5 years ago. Python 3.10 emits DeprecationWarning.
Wait, only Python 3.10? According to the policy, the warning should be there for *at least* two releases. (That's a minimum, for removing entire modules it might make sense to give people even more time.)
asynchat and smtpd are implemented with asyncore. Open issues in asyncore, asynchat and smtpd have been closed as "wont fix" because these modules are deprecated. These modules are basically no longer maintained.
I propose to remove asyncore, aynchat and smtpd in Python 3.11 to reduce the Python maintenance burden, while asyncio remains available in stdlib and is maintained:
- asyncore and asynchat can be replaced with asyncio
- smtpd can be replaced with aiosmtpd which is based on asyncio:
If someone wants to continue using asyncore, asynchat or smtpd, it's trivial to copy Python 3.10 asyncore.py, asynchat.py and smtpd.py to their project, and maintain these files there. Someone is also free to continue maintaining these modules as third-party projects on PyPI.
The removal is discussed at: https://bugs.python.org/issue28533
I wrote a PR to remove the 3 modules: https://github.com/python/cpython/pull/29521
... in short, the intent is to move the asyncore, asynchat and smtpd maintenance outside the Pyhon project ;-) (if anyone still use them)