Skip to content

gh-93243: Make smtpd private before porting its users #93246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Doc/library/email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,3 @@ Legacy API:
Module :mod:`mailbox`
Tools for creating, reading, and managing collections of messages on disk
using a variety standard formats.

Module :mod:`smtpd`
SMTP server framework (primarily useful for testing)
268 changes: 0 additions & 268 deletions Doc/library/smtpd.rst

This file was deleted.

1 change: 0 additions & 1 deletion Doc/library/superseded.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ backwards compatibility. They have been superseded by other modules.
optparse.rst
ossaudiodev.rst
pipes.rst
smtpd.rst
sndhdr.rst
spwd.rst
sunau.rst
Expand Down
12 changes: 12 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@ Removed
(and corresponding ``EXPERIMENTAL_ISOLATED_SUBINTERPRETERS``)
have been removed.

* ``smtpd`` has been removed according to the schedule in :pep:`594`,
having been deprecated in Python 3.4.7 and 3.5.4.
Use aiosmtpd_ PyPI module or any other
:mod:`asyncio`-based server instead.
(Contributed by Oleg Iarygin in :gh:`93243`.)

.. _aiosmtpd: https://pypi.org/project/aiosmtpd/

* Remove ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated in Python
3.10: just use :func:`open` instead. The :func:`open` (:func:`io.open`)
function is a built-in function. Since Python 3.10, :func:`_pyio.open` is
Expand Down Expand Up @@ -382,6 +390,10 @@ Changes in the Python API
to :term:`filesystem encoding and error handler`.
Argument files should be encoded in UTF-8 instead of ANSI Codepage on Windows.

* Removed the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7
and 3.5.4. A recommended replacement is the
:mod:`asyncio`-based aiosmtpd_ PyPI module.

* :func:`shlex.split`: Passing ``None`` for *s* argument now raises an
exception, rather than reading :data:`sys.stdin`. The feature was deprecated
in Python 3.9.
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/mock_socket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Mock socket module used by the smtpd and smtplib tests.
"""Mock socket module used by the smtplib tests.
"""

# imported for _GLOBAL_DEFAULT_TIMEOUT
Expand Down Expand Up @@ -33,7 +33,7 @@ def close(self):


class MockSocket:
"""Mock socket object used by smtpd and smtplib tests.
"""Mock socket object used by the smtplib tests.
"""
def __init__(self, family=None):
global _reply_data
Expand Down
17 changes: 4 additions & 13 deletions Lib/smtpd.py → Lib/test/smtpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,16 @@
import time
import socket
import collections
from warnings import _deprecated, warn
from test.support.import_helper import import_module
from warnings import warn
from email._header_value_parser import get_addr_spec, get_angle_addr

__all__ = [
"SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy",
]

_DEPRECATION_MSG = ('The {name} module is deprecated and unmaintained and will '
'be removed in Python {remove}. Please see aiosmtpd '
'(https://aiosmtpd.readthedocs.io/) for the recommended '
'replacement.')
_deprecated(__name__, _DEPRECATION_MSG, remove=(3, 12))


# These are imported after the above warning so that users get the correct
# deprecation warning.
import asyncore
import asynchat

asyncore = import_module('asyncore', deprecated=True)
asynchat = import_module('asynchat', deprecated=True)

program = sys.argv[0]
__version__ = 'Python SMTP proxy version 0.3'
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@
from socketserver import (ThreadingUDPServer, DatagramRequestHandler,
ThreadingTCPServer, StreamRequestHandler)

with warnings.catch_warnings():
from . import smtpd

asyncore = warnings_helper.import_deprecated('asyncore')
smtpd = warnings_helper.import_deprecated('smtpd')


try:
Expand Down
Loading