FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-47061: use `warnings._deprecated()` with asynchat, asyncore, and smtpd by brettcannon · Pull Request #32350 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 5 additions & 6 deletions Lib/asynchat.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@
import asyncore
from collections import deque

from warnings import warn
warn(
'The asynchat module is deprecated and will be removed in Python 3.12. '
'The recommended replacement is asyncio',
DeprecationWarning,
stacklevel=2)
from warnings import _deprecated

_DEPRECATION_MSG = ('The {name} module is deprecated and will be removed in '
'Python {remove}. The recommended replacement is asyncio')
_deprecated(__name__, _DEPRECATION_MSG, remove=(3, 12))



Expand Down
8 changes: 3 additions & 5 deletions Lib/asyncore.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@
ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \
errorcode

warnings.warn(
'The asyncore module is deprecated and will be removed in Python 3.12. '
'The recommended replacement is asyncio',
DeprecationWarning,
stacklevel=2)
_DEPRECATION_MSG = ('The {name} module is deprecated and will be removed in '
'Python {remove}. The recommended replacement is asyncio')
warnings._deprecated(__name__, _DEPRECATION_MSG, remove=(3, 12))


_DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
Expand Down
13 changes: 6 additions & 7 deletions Lib/smtpd.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,18 @@
import time
import socket
import collections
from warnings import warn
from warnings import _deprecated, warn
from email._header_value_parser import get_addr_spec, get_angle_addr

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

warn(
'The smtpd module is deprecated and unmaintained and will be removed '
'in Python 3.12. Please see aiosmtpd '
'(https://aiosmtpd.readthedocs.io/) for the recommended replacement.',
DeprecationWarning,
stacklevel=2)
_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
Expand Down

Back | FazBrowse Home | New Git URL