summaryrefslogtreecommitdiffstats
path: root/Lib/asynchat.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-09-02 01:25:16 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-09-02 01:25:16 (GMT)
commit1eaf0742d877fd9d84d6ed82a04bc33b027e9ad0 (patch)
tree1c1ee3a5dee04f5f4657b707e9d54ca2e28b1505 /Lib/asynchat.py
parent86533776c291c031853609ceaeda96eb2808e4ee (diff)
downloadcpython-1eaf0742d877fd9d84d6ed82a04bc33b027e9ad0.zip
cpython-1eaf0742d877fd9d84d6ed82a04bc33b027e9ad0.tar.gz
cpython-1eaf0742d877fd9d84d6ed82a04bc33b027e9ad0.tar.bz2
Move test.test_support.catch_warning() to the warnings module, rename it
catch_warnings(), and clean up the API. While expanding the test suite, a bug was found where a warning about the 'line' argument to showwarning() was not letting functions with '*args' go without a warning. Closes issue 3602. Code review by Benjamin Peterson.
Diffstat (limited to 'Lib/asynchat.py')
-rw-r--r--Lib/asynchat.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index 121b467..a97de93 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -49,8 +49,9 @@ you - by calling your self.found_terminator() method.
import socket
import asyncore
from collections import deque
+from sys import py3kwarning
from test.test_support import catch_warning
-from warnings import filterwarnings
+from warnings import filterwarnings, catch_warnings
class async_chat (asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
@@ -218,8 +219,9 @@ class async_chat (asyncore.dispatcher):
# handle classic producer behavior
obs = self.ac_out_buffer_size
try:
- with catch_warning(record=False):
- filterwarnings("ignore", ".*buffer", DeprecationWarning)
+ with catch_warnings():
+ if py3kwarning:
+ filterwarnings("ignore", ".*buffer", DeprecationWarning)
data = buffer(first, 0, obs)
except TypeError:
data = first.more()