]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Suppress the warning in asynchat from using buffer() when running udner -3.
authorBrett Cannon <bcannon@gmail.com>
Sat, 9 Aug 2008 23:06:16 +0000 (23:06 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 9 Aug 2008 23:06:16 +0000 (23:06 +0000)
Naively removing the usage causes a large number of test failures, so it was
just easier to suppress the warning.

Lib/asynchat.py
Misc/NEWS

index 8a7176d10c89b1202cbcd90ee477e501bbc14e1a..121b467d4903e1621b09a064b02b9357dfe907e7 100644 (file)
@@ -49,6 +49,8 @@ you - by calling your self.found_terminator() method.
 import socket
 import asyncore
 from collections import deque
+from test.test_support import catch_warning
+from warnings import filterwarnings
 
 class async_chat (asyncore.dispatcher):
     """This is an abstract class.  You must derive from this class, and add
@@ -216,7 +218,9 @@ class async_chat (asyncore.dispatcher):
             # handle classic producer behavior
             obs = self.ac_out_buffer_size
             try:
-                data = buffer(first, 0, obs)
+                with catch_warning(record=False):
+                    filterwarnings("ignore", ".*buffer", DeprecationWarning)
+                    data = buffer(first, 0, obs)
             except TypeError:
                 data = first.more()
                 if data:
index 9aebd123c79ec3b65e32f310697bfc31fec6cf73..582bd22c5639e0de9b072cab00fd3fb9b139cbfb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -56,7 +56,7 @@ Library
   the reload() built-in has been removed.
 
 - Changed code in the following modules/packages to remove warnings raised
-  while running under the ``-3`` flag: aifc, asyncore, bdb, bsddb,
+  while running under the ``-3`` flag: aifc, asynchat, asyncore, bdb, bsddb,
   ConfigParser, cookielib, DocXMLRPCServer, email, filecmp, fileinput, inspect,
   logging, modulefinder, pdb, pickle, profile, pstats, pydoc, re, rlcompleter,
   SimpleXMLRPCServer, shelve, socket, subprocess, sqlite3, tarfile, Tkinter,