summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-24 15:16:02 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-24 15:16:02 (GMT)
commit2062937aff803fe0b8e26c20c5585675b852fb8f (patch)
tree1e670e64fd94c94a9ded5332fa19c0bb2151025f
parent08be72d0aa0112118b79d271479598c218adfd23 (diff)
downloadcpython-2062937aff803fe0b8e26c20c5585675b852fb8f.zip
cpython-2062937aff803fe0b8e26c20c5585675b852fb8f.tar.gz
cpython-2062937aff803fe0b8e26c20c5585675b852fb8f.tar.bz2
Add documentation about the default warnings filters.
-rw-r--r--Doc/library/warnings.rst24
1 files changed, 21 insertions, 3 deletions
diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst
index 64689ad..720da0f 100644
--- a/Doc/library/warnings.rst
+++ b/Doc/library/warnings.rst
@@ -94,9 +94,6 @@ User code can define additional warning categories by subclassing one of the
standard warning categories. A warning category must always be a subclass of
the :exc:`Warning` class.
-.. versionchanged:: 3.2
- :exc:`DeprecationWarning` is ignored by default.
-
.. _warning-filter:
@@ -157,6 +154,27 @@ interpreter command line. The interpreter saves the arguments for all
are ignored, after printing a message to ``sys.stderr``).
+Default Warning Filters
+~~~~~~~~~~~~~~~~~~~~~~~
+
+By default, Python installs several warning filters, which can be overridden by
+the command-line options passed to :option:`-W` and calls to
+:func:`filterwarnings`.
+
+* :exc:`DeprecationWarning` and :exc:`PendingDeprecationWarning`, and
+ :exc:`ImportWarning` are ignored.
+
+* :exc:`BytesWarning` is ignored unless the :option:`-b` option is given once or
+ twice; in this case this warning is either printed (``-b``) or turned into an
+ exception (``-bb`).
+
+* :exc:`ResourceWarning` is ignored unless Python was built in debug mode.
+
+.. versionchanged:: 3.2
+ :exc:`DeprecationWarning` is now ignored by default in addition to
+ :exc:`PendingDeprecationWarning`.
+
+
.. _warning-suppress:
Temporarily Suppressing Warnings