[Python-checkins] r65613 - in python/trunk: Lib/asynchat.py Misc/NEWS

brett.cannon python-checkins at python.org
Sun Aug 10 01:06:17 CEST 2008


Author: brett.cannon
Date: Sun Aug 10 01:06:16 2008
New Revision: 65613

Log:
Suppress the warning in asynchat from using buffer() when running udner -3.
Naively removing the usage causes a large number of test failures, so it was
just easier to suppress the warning.


Modified:
   python/trunk/Lib/asynchat.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/asynchat.py
==============================================================================
--- python/trunk/Lib/asynchat.py	(original)
+++ python/trunk/Lib/asynchat.py	Sun Aug 10 01:06:16 2008
@@ -49,6 +49,8 @@
 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 @@
             # 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:

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Aug 10 01:06:16 2008
@@ -56,7 +56,7 @@
   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,


More information about the Python-checkins mailing list