]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #27034: Removed deprecated class asynchat.fifo.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 16 May 2016 06:10:43 +0000 (09:10 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 16 May 2016 06:10:43 +0000 (09:10 +0300)
Doc/library/asynchat.rst
Lib/asynchat.py
Lib/test/test_asynchat.py
Misc/NEWS

index 56ad4f8f3f46632f85005d61ae222b3afa20e1aa..1ff3dd8a3d620b94de7b88321bd57e069683f9c4 100644 (file)
@@ -57,13 +57,13 @@ connection requests.
       The asynchronous output buffer size (default ``4096``).
 
    Unlike :class:`asyncore.dispatcher`, :class:`async_chat` allows you to
-   define a first-in-first-out queue (fifo) of *producers*. A producer need
+   define a :abbr:`FIFO (first-in, first-out)` queue of *producers*. A producer need
    have only one method, :meth:`more`, which should return data to be
    transmitted on the channel.
    The producer indicates exhaustion (*i.e.* that it contains no more data) by
    having its :meth:`more` method return the empty bytes object. At this point
-   the :class:`async_chat` object removes the producer from the fifo and starts
-   using the next producer, if any. When the producer fifo is empty the
+   the :class:`async_chat` object removes the producer from the queue and starts
+   using the next producer, if any. When the producer queue is empty the
    :meth:`handle_write` method does nothing. You use the channel object's
    :meth:`set_terminator` method to describe how to recognize the end of, or
    an important breakpoint in, an incoming transmission from the remote
@@ -77,8 +77,8 @@ connection requests.
 
 .. method:: async_chat.close_when_done()
 
-   Pushes a ``None`` on to the producer fifo. When this producer is popped off
-   the fifo it causes the channel to be closed.
+   Pushes a ``None`` on to the producer queue. When this producer is popped off
+   the queue it causes the channel to be closed.
 
 
 .. method:: async_chat.collect_incoming_data(data)
@@ -91,7 +91,7 @@ connection requests.
 .. method:: async_chat.discard_buffers()
 
    In emergencies this method will discard any data held in the input and/or
-   output buffers and the producer fifo.
+   output buffers and the producer queue.
 
 
 .. method:: async_chat.found_terminator()
@@ -109,7 +109,7 @@ connection requests.
 
 .. method:: async_chat.push(data)
 
-   Pushes data on to the channel's fifo to ensure its transmission.
+   Pushes data on to the channel's queue to ensure its transmission.
    This is all you need to do to have the channel write the data out to the
    network, although it is possible to use your own producers in more complex
    schemes to implement encryption and chunking, for example.
@@ -117,7 +117,7 @@ connection requests.
 
 .. method:: async_chat.push_with_producer(producer)
 
-   Takes a producer object and adds it to the producer fifo associated with
+   Takes a producer object and adds it to the producer queue associated with
    the channel.  When all currently-pushed producers have been exhausted the
    channel will consume this producer's data by calling its :meth:`more`
    method and send the data to the remote endpoint.
index f728d1b47053ea894f30592b58ae6215583dad16..fc1146adbb10dc5a8a3d0853afd83bdec9ecadb4 100644 (file)
@@ -285,35 +285,6 @@ class simple_producer:
             return result
 
 
-class fifo:
-    def __init__(self, list=None):
-        import warnings
-        warnings.warn('fifo class will be removed in Python 3.6',
-                      DeprecationWarning, stacklevel=2)
-        if not list:
-            self.list = deque()
-        else:
-            self.list = deque(list)
-
-    def __len__(self):
-        return len(self.list)
-
-    def is_empty(self):
-        return not self.list
-
-    def first(self):
-        return self.list[0]
-
-    def push(self, data):
-        self.list.append(data)
-
-    def pop(self):
-        if self.list:
-            return (1, self.list.popleft())
-        else:
-            return (0, None)
-
-
 # Given 'haystack', see if any prefix of 'needle' is at its end.  This
 # assumes an exact match has already been checked.  Return the number of
 # characters matched.
index 08090b8a06f6c5fe6e792381a4bc0f9d73f438b8..0eba76db4782102a9d42c0224527c4eaeeecbfe7 100644 (file)
@@ -296,37 +296,6 @@ class TestHelperFunctions(unittest.TestCase):
         self.assertEqual(asynchat.find_prefix_at_end("qwertydkjf", "\r\n"), 0)
 
 
-class TestFifo(unittest.TestCase):
-    def test_basic(self):
-        with self.assertWarns(DeprecationWarning) as cm:
-            f = asynchat.fifo()
-        self.assertEqual(str(cm.warning),
-                         "fifo class will be removed in Python 3.6")
-        f.push(7)
-        f.push(b'a')
-        self.assertEqual(len(f), 2)
-        self.assertEqual(f.first(), 7)
-        self.assertEqual(f.pop(), (1, 7))
-        self.assertEqual(len(f), 1)
-        self.assertEqual(f.first(), b'a')
-        self.assertEqual(f.is_empty(), False)
-        self.assertEqual(f.pop(), (1, b'a'))
-        self.assertEqual(len(f), 0)
-        self.assertEqual(f.is_empty(), True)
-        self.assertEqual(f.pop(), (0, None))
-
-    def test_given_list(self):
-        with self.assertWarns(DeprecationWarning) as cm:
-            f = asynchat.fifo([b'x', 17, 3])
-        self.assertEqual(str(cm.warning),
-                         "fifo class will be removed in Python 3.6")
-        self.assertEqual(len(f), 3)
-        self.assertEqual(f.pop(), (1, b'x'))
-        self.assertEqual(f.pop(), (1, 17))
-        self.assertEqual(f.pop(), (1, 3))
-        self.assertEqual(f.pop(), (0, None))
-
-
 class TestNotConnected(unittest.TestCase):
     def test_disallow_negative_terminator(self):
         # Issue #11259
index 5745cc322e9791c4e4bccbf352ef1fd3b23000ea..8c9a1ddb7cd8824e4eb8cf37b9831bbaa31dc49a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -277,6 +277,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #27034: Removed deprecated class asynchat.fifo.
+
 - Issue #26870: Added readline.set_auto_history(), which can stop entries
   being automatically added to the history list.  Based on patch by Tyler
   Crompton.