You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove asyncore, asynchat and smtpd modules #72719
Since this issue is now a significant blocker for PEP-594 (remove stdlib dead batteries, which includes asyncore and asynchat), I'm going to prioritize working on this and assign it to myself.
I propose to remove the expert-asyncio label from this issue. Any objections? This doesn't require an asyncio expert at all, it's just documentation and removals (or deprecations?).
I think that was referring to tests that need to be rewritten with asyncio. The alternative is to move these modules (or parts of them) to test.support so the tests continue to work.
I think that was referring to tests that need to be rewritten with asyncio. The alternative is to move these modules (or parts of them) to test.support so the tests continue to work.
That still doesn't require pinging the asyncio experts, IMO (and my opinion counts since I'm the only active one :-). I'll remove the label.
The alternative is to move these modules (or parts of them) to test.support so the tests continue to work.
IMO that's a convenient way to unblock the issue. Moving away from asyncore/asynchat would be nice but nobody managed to update tests in 10 years, so maybe it's ok to not changed them until it becomes a major (blocking) issue :-)
I've moved these modules to test/support as @iritkatriel and @vstinner proposed.
For now, they were coppied as-is (probably some parts are unused, but this is a subject to another piece of work).
In 2021, I already removed the 3 modules (asyncore, asynchat, smtpd) in Python 3.11, but the Steering Council asked me to revert it since these modules only emitted a DeprecationWarning in 1 Python release (Python 3.10):
Brett Cannon wrote on python-dev that "the modules got yanked prematurely", the removal didn't follow PEP 387 process (updated to require a deprecation in at least 2 Python versions, rather than 1).
The removal is now covered by PEP 594 which has been approved the SC.
You can now help the remaining projects still using the removed projects to be upgrade to asyncio and aiosmptd. People can also collaborate to maintain the 3 removed modules outside Python (on PyPI) if they want. Just copy code, tests and doc from Python 3.11.
Activity
Mariatta commentedon Oct 25, 2016
Deprecation warning was added to asyncore in https://bugs.python.org/issue25002
asyncore is still used in several tests and should be replaced.
vstinner commentedon Apr 19, 2017
Here is the list of Python files using asyncore:
haypo@selma$ grep -l asyncore $(find -name "*.py")
./Lib/asyncore.py
./Lib/asynchat.py
./Lib/test/test_smtpd.py
./Lib/test/test_asyncore.py
./Lib/test/test_smtplib.py
./Lib/test/test_os.py
./Lib/test/test_ssl.py
./Lib/test/test_logging.py
./Lib/test/libregrtest/save_env.py
./Lib/test/test_asynchat.py
./Lib/test/test_pyclbr.py
./Lib/test/test_support.py
./Lib/test/test_poplib.py
./Lib/test/test_ftplib.py
./Lib/smtpd.py
smtpd has been rewritten with asyncio:
http://aiosmtpd.readthedocs.io/
The documentation of the smtpd module already points to aiosmtpd.
libregrtest/save_env.py only checks that asyncore.socket_map is not modified, we can keep it until asyncore is really removed.
test_support.py only tests that it's possible to have a "clean" import of asyncore, it can be easily be replaced later.
The list can reduced to:
./Lib/test/test_smtplib.py
./Lib/test/test_os.py
./Lib/test/test_ssl.py
./Lib/test/test_logging.py
./Lib/test/test_pyclbr.py
./Lib/test/test_poplib.py
./Lib/test/test_ftplib.py
vstinner commentedon Apr 19, 2017
asyncore was modified to emit a DeprecationWarning:
http://bugs.python.org/issue25002#msg279417
But then a lot of code starts with to fail -Werror.
Copy of Martin Panter's msg279469:
I normally run the tests with -Werror, and the failures I get are:
grzgrzgrz3 commentedon May 29, 2017
I would like to work on this issue.
I think it's a good idea to split this task into few parts/PR.
Let me start from ./Lib/test/test_poplib.py.
What about rewriting pop3 server stub using asyncio, i think requests could be handled synchronously, there will be no benefits from asynchronous.
Please let me know what you think.
vstinner commentedon May 29, 2017
Once you have a patch, open a new issue and mention it here.
grzgrzgrz3 commentedon May 30, 2017
./Lib/test/test_poplib.py
sub-issue bpo-28533
grzgrzgrz3 commentedon May 30, 2017
./Lib/test/test_poplib.py
sub-issue bpo-30514
Fixed issue number from previous comment
OhSoDank commentedon Nov 11, 2019
Hi, is this still open?
I'm happy to work on replacing asyncore usage in one of the other test files.
nanjekyejoannah commentedon Nov 11, 2019
@dankreso, the issue is still open and no one has claimed it yet. So feel free to open a pull request.
aeros commentedon Nov 11, 2019
Sounds good, just let us know which one(s) you're working on. (:
jacksonriley commentedon Nov 20, 2019
Lib/test/test_pyclbr.py - subissue bpo-38866
A trivial one!
aeros commentedon Oct 22, 2020
Since this issue is now a significant blocker for PEP-594 (remove stdlib dead batteries, which includes asyncore and asynchat), I'm going to prioritize working on this and assign it to myself.
43 remaining items
iritkatriel commentedon Aug 28, 2022
We should be able to un-revert this now.
gvanrossum commentedon Aug 28, 2022
I propose to remove the
expert-asynciolabel from this issue. Any objections? This doesn't require an asyncio expert at all, it's just documentation and removals (or deprecations?).iritkatriel commentedon Aug 28, 2022
I think that was referring to tests that need to be rewritten with asyncio. The alternative is to move these modules (or parts of them) to test.support so the tests continue to work.
gvanrossum commentedon Aug 28, 2022
That still doesn't require pinging the asyncio experts, IMO (and my opinion counts since I'm the only active one :-). I'll remove the label.
vstinner commentedon Aug 29, 2022
IMO that's a convenient way to unblock the issue. Moving away from asyncore/asynchat would be nice but nobody managed to update tests in 10 years, so maybe it's ok to not changed them until it becomes a major (blocking) issue :-)
pythongh-72719: Remove deprecated `asyncore` and `asynchat` modules
pythongh-72719: Remove deprecated `asyncore` and `asynchat` modules
pythongh-72719: Remove deprecated `asyncore` and `asynchat` modules
pythongh-72719: Remove deprecated `asyncore` and `asynchat` modules
sobolevn commentedon Sep 12, 2022
I've moved these modules to
test/supportas @iritkatriel and @vstinner proposed.For now, they were coppied as-is (probably some parts are unused, but this is a subject to another piece of work).
Tests do continue to pass! 🎉
gh-72719: Remove asyncore and asynchat modules (#96580)
vstinner commentedon Nov 8, 2022
asyncore, asynchat, smtpd are removed again in the main branch (future Python 3.12). Let's see how it goes this time.
Summary of this issue.
The asyncore/asynchat deprecation has a long history starting in 2015: https://bugs.python.org/issue25002
In 2020, Kyle Stanley @aeros worked on the removal in a branch: https://github.com/aeros/cpython/tree/remove-asycore-asynchat-smtpd
In 2021, I already removed the 3 modules (asyncore, asynchat, smtpd) in Python 3.11, but the Steering Council asked me to revert it since these modules only emitted a DeprecationWarning in 1 Python release (Python 3.10):
After my revert, I notified Mercurial and Ansible that these 3 projects are deprecated since 2015.
In 2022, these modules are removed again in Python 3.12:
asyncoreandasynchatmodules #96580 and commit e56e33dThe removal is now covered by PEP 594 which has been approved the SC.
You can now help the remaining projects still using the removed projects to be upgrade to asyncio and aiosmptd. People can also collaborate to maintain the 3 removed modules outside Python (on PyPI) if they want. Just copy code, tests and doc from Python 3.11.