Skip to content

Remove asyncore, asynchat and smtpd modules #89943

Closed

Description

@vstinner
BPO 45785
Nosy @vstinner, @tiran
Superseder
  • bpo-28533: Remove asyncore, asynchat and smtpd modules
  • 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 = <Date 2021-11-11.12:40:10.266>
    created_at = <Date 2021-11-11.11:38:14.399>
    labels = ['library', '3.11']
    title = 'Remove asyncore, asynchat and smtpd modules'
    updated_at = <Date 2021-11-11.12:40:10.265>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2021-11-11.12:40:10.265>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-11-11.12:40:10.266>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2021-11-11.11:38:14.399>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45785
    keywords = []
    message_count = 3.0
    messages = ['406156', '406157', '406158']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'christian.heimes']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '28533'
    type = None
    url = 'https://bugs.python.org/issue45785'
    versions = ['Python 3.11']

    Activity

    1. vstinner commented on Nov 11, 2021

      @vstinner
      MemberAuthor

      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.

      Documentation:

      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:

      Projects using asyncore and asynchat should use asyncio. If someone really wants to continue using asyncore and asynchat, it's trivial to copy asyncore.py and asynchat.py 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/smtpd.py to Lib/test/support/_smtpd.py.

      Projects using smtpd can consider using aiosmtpd which is based on asyncio:
      https://aiosmtpd.readthedocs.io/

      Or again, they can copy Python 3.10 smtpd.py in their project and maintain this file on their side.

    2. added
      3.11only security fixes
      stdlibStandard Library Python modules in the Lib/ directory
      on Nov 11, 2021
    3. vstinner commented on Nov 11, 2021

      @vstinner
      MemberAuthor

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

      https://docs.python.org/dev/whatsnew/3.10.html#asynchat-asyncore-smtpd

    4. tiran commented on Nov 11, 2021

      @tiran
      Member

      +1

      This bug is kind of a duplicate of bpo-28533.

      A year ago Kyle worked on a patch. You can find their work at https://github.com/aeros/cpython/tree/remove-asycore-asynchat-smtpd

    5. transferred this issue fromon Apr 10, 2022
    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.11only security fixesstdlibStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions