[Python-checkins] cpython (3.6): Issue 25002: Deprecate asyncore/asynchat. Patch by Mariatta.

guido.van.rossum python-checkins at python.org
Tue Oct 25 11:49:54 EDT 2016


https://hg.python.org/cpython/rev/bb23770f82f1
changeset:   104718:bb23770f82f1
branch:      3.6
parent:      104716:2def8a24c299
user:        Guido van Rossum <guido at python.org>
date:        Tue Oct 25 08:49:13 2016 -0700
summary:
  Issue 25002: Deprecate asyncore/asynchat. Patch by Mariatta.

files:
  Doc/library/asynchat.rst |  3 +++
  Doc/library/asyncore.rst |  3 +++
  Lib/asynchat.py          |  5 +++++
  Lib/asyncore.py          |  4 ++++
  4 files changed, 15 insertions(+), 0 deletions(-)


diff --git a/Doc/library/asynchat.rst b/Doc/library/asynchat.rst
--- a/Doc/library/asynchat.rst
+++ b/Doc/library/asynchat.rst
@@ -9,6 +9,9 @@
 
 **Source code:** :source:`Lib/asynchat.py`
 
+.. deprecated:: 3.6
+   Please use :mod:`asyncio` instead.
+
 --------------
 
 .. note::
diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst
--- a/Doc/library/asyncore.rst
+++ b/Doc/library/asyncore.rst
@@ -12,6 +12,9 @@
 
 **Source code:** :source:`Lib/asyncore.py`
 
+.. deprecated:: 3.6
+   Please use :mod:`asyncio` instead.
+
 --------------
 
 .. note::
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -46,8 +46,13 @@
 you - by calling your self.found_terminator() method.
 """
 import asyncore
+import warnings
+
 from collections import deque
 
+warnings.warn(
+    'asynchat module is deprecated in 3.6. Use asyncio instead.',
+    PendingDeprecationWarning, stacklevel=2)
 
 class async_chat(asyncore.dispatcher):
     """This is an abstract class.  You must derive from this class, and add
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -60,6 +60,10 @@
 _DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
                            EBADF})
 
+warnings.warn(
+    'asyncore module is deprecated in 3.6. Use asyncio instead.',
+    PendingDeprecationWarning, stacklevel=2)
+
 try:
     socket_map
 except NameError:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list