mirror of
https://github.com/python/cpython.git
synced 2025-08-28 04:35:02 +00:00
bpo-47061: use warnings._deprecated()
with asynchat, asyncore, and smtpd (GH-32350)
This commit is contained in:
parent
59a99ae277
commit
32b33879c2
3 changed files with 14 additions and 18 deletions
|
@ -48,12 +48,11 @@ you - by calling your self.found_terminator() method.
|
||||||
import asyncore
|
import asyncore
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
from warnings import warn
|
from warnings import _deprecated
|
||||||
warn(
|
|
||||||
'The asynchat module is deprecated and will be removed in Python 3.12. '
|
_DEPRECATION_MSG = ('The {name} module is deprecated and will be removed in '
|
||||||
'The recommended replacement is asyncio',
|
'Python {remove}. The recommended replacement is asyncio')
|
||||||
DeprecationWarning,
|
_deprecated(__name__, _DEPRECATION_MSG, remove=(3, 12))
|
||||||
stacklevel=2)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,11 +57,9 @@ from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
|
||||||
ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \
|
ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \
|
||||||
errorcode
|
errorcode
|
||||||
|
|
||||||
warnings.warn(
|
_DEPRECATION_MSG = ('The {name} module is deprecated and will be removed in '
|
||||||
'The asyncore module is deprecated and will be removed in Python 3.12. '
|
'Python {remove}. The recommended replacement is asyncio')
|
||||||
'The recommended replacement is asyncio',
|
warnings._deprecated(__name__, _DEPRECATION_MSG, remove=(3, 12))
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2)
|
|
||||||
|
|
||||||
|
|
||||||
_DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
|
_DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
|
||||||
|
|
13
Lib/smtpd.py
13
Lib/smtpd.py
|
@ -77,19 +77,18 @@ import getopt
|
||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
import collections
|
import collections
|
||||||
from warnings import warn
|
from warnings import _deprecated, warn
|
||||||
from email._header_value_parser import get_addr_spec, get_angle_addr
|
from email._header_value_parser import get_addr_spec, get_angle_addr
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy",
|
"SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy",
|
||||||
]
|
]
|
||||||
|
|
||||||
warn(
|
_DEPRECATION_MSG = ('The {name} module is deprecated and unmaintained and will '
|
||||||
'The smtpd module is deprecated and unmaintained and will be removed '
|
'be removed in Python {remove}. Please see aiosmtpd '
|
||||||
'in Python 3.12. Please see aiosmtpd '
|
'(https://aiosmtpd.readthedocs.io/) for the recommended '
|
||||||
'(https://aiosmtpd.readthedocs.io/) for the recommended replacement.',
|
'replacement.')
|
||||||
DeprecationWarning,
|
_deprecated(__name__, _DEPRECATION_MSG, remove=(3, 12))
|
||||||
stacklevel=2)
|
|
||||||
|
|
||||||
|
|
||||||
# These are imported after the above warning so that users get the correct
|
# These are imported after the above warning so that users get the correct
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue