summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.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/cgi.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/cgi.py')
-rwxr-xr-xLib/cgi.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 3a795c9..dd11389 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -39,13 +39,14 @@ import sys
import os
import urllib
import UserDict
-from test.test_support import catch_warning
-from warnings import filterwarnings
-with catch_warning(record=False):
- filterwarnings("ignore", ".*mimetools has been removed",
- DeprecationWarning)
+from warnings import filterwarnings, catch_warnings
+with catch_warnings():
+ if sys.py3kwarning:
+ filterwarnings("ignore", ".*mimetools has been removed",
+ DeprecationWarning)
import mimetools
- filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
+ if sys.py3kwarning:
+ filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
import rfc822
try: