summaryrefslogtreecommitdiff
path: root/Lib/asyncore.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2021-06-24 12:37:26 -0700
committerGitHub <noreply@github.com>2021-06-24 12:37:26 -0700
commit8488b85c6397fe58f17fc00e047044c959ac0b04 (patch)
tree379e7953b538a0f0aa5652e5613c4005c0dfa828 /Lib/asyncore.py
parent19459f8ce63cc7f905e3c1a55d09d4d10d245343 (diff)
downloadcpython-git-8488b85c6397fe58f17fc00e047044c959ac0b04.tar.gz
bpo-44498: Issue a deprecation warning on asynchat, asyncore and smtpd import (#26882)
* Issue a deprecation warning on smtpd import * Also issue DeprecationWarnings for asynchat and asyncore * Fix some tests * test___all__ requires the word 'module' or 'package' in the deprecation warning text, so add those to smtpd, asynchat, and asyncore. * In test_support, use pprint now instead of asyncore as the landmark. * Add What's New * Use ..deprecated:: * Use ..deprecated:: * Update Lib/smtpd.py Co-authored-by: Miro Hrončok <miro@hroncok.cz> * Update Doc/library/smtpd.rst Co-authored-by: Miro Hrončok <miro@hroncok.cz> * Import async{hat,ore} after the DeprecationWarning for this module Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r--Lib/asyncore.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index eeea488886..b1eea4bf65 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -57,6 +57,13 @@ from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \
errorcode
+warnings.warn(
+ 'The asyncore module is deprecated. '
+ 'The recommended replacement is asyncio',
+ DeprecationWarning,
+ stacklevel=2)
+
+
_DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
EBADF})