[Python-checkins] r85825 - python/branches/py3k/Doc/library/warnings.rst
georg.brandl
python-checkins at python.org
Sun Oct 24 17:16:02 CEST 2010
Author: georg.brandl
Date: Sun Oct 24 17:16:02 2010
New Revision: 85825
Log:
Add documentation about the default warnings filters.
Modified:
python/branches/py3k/Doc/library/warnings.rst
Modified: python/branches/py3k/Doc/library/warnings.rst
==============================================================================
--- python/branches/py3k/Doc/library/warnings.rst (original)
+++ python/branches/py3k/Doc/library/warnings.rst Sun Oct 24 17:16:02 2010
@@ -94,9 +94,6 @@
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 @@
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
More information about the Python-checkins
mailing list