Skip to content

Remove asyncore, asynchat and smtpd modules #72719

Closed

Description

@Mariatta
BPO 28533
Nosy @warsaw, @orsenthil, @vstinner, @asvetlov, @1st1, @grzgrzgrz3, @Mariatta, @nanjekyejoannah, @aeros, @jacksonriley, @OhSoDank, @iritkatriel
PRs
  • bpo-28533: Remove asyncore, asynchat, smtpd modules #29521
  • Revert "bpo-28533: Remove asyncore, asynchat, smtpd modules (GH-29521)" #29951
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2016-10-25.18:32:04.420>
    labels = ['3.11', 'tests', 'expert-asyncio']
    title = 'Remove asyncore, asynchat and smtpd modules'
    updated_at = <Date 2022-02-24.13:39:30.092>
    user = 'https://github.com/Mariatta'

    bugs.python.org fields:

    activity = <Date 2022-02-24.13:39:30.092>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests', 'asyncio']
    creation = <Date 2016-10-25.18:32:04.420>
    creator = 'Mariatta'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 28533
    keywords = ['patch']
    message_count = 37.0
    messages = ['279439', '291907', '291908', '294710', '294712', '294771', '294773', '356355', '356364', '356369', '357088', '379342', '396295', '396297', '396319', '396323', '404575', '406159', '406160', '406161', '406162', '406170', '406173', '406208', '406210', '406213', '406214', '406215', '406372', '406377', '406434', '407559', '407560', '407897', '407900', '407915', '413909']
    nosy_count = 12.0
    nosy_names = ['barry', 'orsenthil', 'vstinner', 'asvetlov', 'yselivanov', 'grzgrzgrz3', 'Mariatta', 'nanjekyejoannah', 'aeros', 'jacksonriley', 'dankreso', 'iritkatriel']
    pr_nums = ['29521', '29951']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue28533'
    versions = ['Python 3.11']

    Activity

    1. Mariatta commented on Oct 25, 2016

      @Mariatta
      MemberAuthor

      Deprecation warning was added to asyncore in https://bugs.python.org/issue25002

      asyncore is still used in several tests and should be replaced.

    2. vstinner commented on Apr 19, 2017

      @vstinner
      Member

      asyncore is still used in several tests and should be replaced.

      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

    3. vstinner commented on Apr 19, 2017

      @vstinner
      Member

      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:

      • test_ssl, test_smtplib, test_poplib, test_logging, test_ftplib, test_support: tests use asyncore
      • test_os: test uses asynchat (When you import asynchat, the first error complains about importing asyncore, there are actually two warnings)
      • test_all: This seems to ignore DeprecationWarning; perhaps an exception for PendingDeprecationWarning should also be added?
      • test_asyncore and test_asynchat: Obviously these have to still test the modules, so they should anticipate the warnings, perhaps using Serhiy’s code
      • test_smtpd: smtpd module itself uses asyncore; see bpo-25008
    4. grzgrzgrz3 commented on May 29, 2017

      grzgrzgrz3mannequin
      Mannequin

      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.

    5. vstinner commented on May 29, 2017

      @vstinner
      Member

      I think it's a good idea to split this task into few parts/PR. Let me start from ./Lib/test/test_poplib.py.

      Once you have a patch, open a new issue and mention it here.

    6. grzgrzgrz3 commented on May 30, 2017

      grzgrzgrz3mannequin
      Mannequin

      ./Lib/test/test_poplib.py
      sub-issue bpo-28533

    7. grzgrzgrz3 commented on May 30, 2017

      grzgrzgrz3mannequin
      Mannequin

      ./Lib/test/test_poplib.py
      sub-issue bpo-30514

      Fixed issue number from previous comment

    8. OhSoDank commented on Nov 11, 2019

      OhSoDankmannequin
      Mannequin

      Hi, is this still open?

      I'm happy to work on replacing asyncore usage in one of the other test files.

    9. nanjekyejoannah commented on Nov 11, 2019

      @nanjekyejoannah
      Contributor

      @dankreso, the issue is still open and no one has claimed it yet. So feel free to open a pull request.

    10. aeros commented on Nov 11, 2019

      @aeros
      Contributor

      I'm happy to work on replacing asyncore usage in one of the other test files.

      Sounds good, just let us know which one(s) you're working on. (:

    11. jacksonriley commented on Nov 20, 2019

      jacksonrileymannequin
      Mannequin

      Lib/test/test_pyclbr.py - subissue bpo-38866
      A trivial one!

    12. aeros commented on Oct 22, 2020

      @aeros
      Contributor

      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.

    13. self-assigned this
      on Oct 22, 2020
    14. 43 remaining items

    15. iritkatriel commented on Aug 28, 2022

      @iritkatriel
      Member

      Follow-up: PEP 594 has been accepted and asyncore, asynchat and smtpd are set for removal in 3.12.

      Merged documentation PRs:

      Pending removal PR:

      Newer removal PR that was merged...

      And reverted:

      We should be able to un-revert this now.

    16. gvanrossum commented on Aug 28, 2022

      @gvanrossum
      Member

      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?).

    17. iritkatriel commented on Aug 28, 2022

      @iritkatriel
      Member

      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.

    18. gvanrossum commented on Aug 28, 2022

      @gvanrossum
      Member

      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.

    19. vstinner commented on Aug 29, 2022

      @vstinner
      Member

      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 :-)

    20. added 4 commits that reference this issue on Sep 5, 2022
    21. sobolevn commented on Sep 12, 2022

      @sobolevn
      Member

      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).

      Tests do continue to pass! 🎉

    22. added a commit that references this issue on Nov 8, 2022
    23. vstinner commented on Nov 8, 2022

      @vstinner
      Member

      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:

      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.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.12only security fixestestsTests in the Lib/test dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions