This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Remove asyncore, asynchat and smtpd modules
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.11
Status: closed Resolution: duplicate
Dependencies: Superseder: Remove asyncore, asynchat and smtpd modules
View: 28533
Assigned To: Nosy List: christian.heimes, vstinner
Priority: normal Keywords:

Created on 2021-11-11 11:38 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg406156 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-11-11 11:38
I propose to remove asyncore, asynchat and smtpd modules from the Python standard library to remove the Python maintenance burden. These modules are deprecated since Python 3.6.


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 and asynchat module in Python 3.6 released in 2016, 5 years ago. Open issues in asyncore and asynchat have been closed as "wont fix" because the module is deprecated. The two modules are basically no longer maintained.



I propose to remove the two modules right now in the Python stdlib. They were removed for 4 Python releases (3.6-3.10), it's long enough to respect the PEP 387. The PEP requires 2 Python releases at least before considering removing code.

Since there are still 7 tests of the Python test suite still uses asyncore and asynchat, I propose to move these modules in Lib/test/ directory and make them private:

* Rename Lib/ to Lib/test/support/
* Rename Lib/ to Lib/test/support/

Projects using asyncore and asynchat should use asyncio. If someone really wants to continue using asyncore and asynchat, it's trivial to copy and in their project, and maintain these files on their side.


About the smtpd module, it is also deprecated since Python 3.6 (deprecated for 4 Python releases). It's used by a single test (test_logging). I also propose to remove it from the stdlib.

I proposed to rename Lib/ to Lib/test/support/

Projects using smtpd can consider using aiosmtpd which is based on asyncio:

Or again, they can copy Python 3.10 in their project and maintain this file on their side.
msg406157 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-11-11 11:55
Ah, a DeprecationWarning warning is only emitted at runtime since Python 3.10. What's New in Python 3.10:

"asynchat, asyncore, smtpd: These modules have been marked as deprecated in their module documentation since Python 3.6.  An import-time DeprecationWarning has now been added to all three of these modules."
msg406158 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-11 11:57

This bug is kind of a duplicate of #28533.

A year ago Kyle worked on a patch. You can find their work at
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89943
2021-11-11 12:40:10vstinnersetstatus: open -> closed
resolution: duplicate
stage: resolved
2021-11-11 11:57:52christian.heimessetsuperseder: Remove asyncore, asynchat and smtpd modules

messages: + msg406158
nosy: + christian.heimes
2021-11-11 11:55:22vstinnersetmessages: + msg406157
2021-11-11 11:38:14vstinnercreate