summaryrefslogtreecommitdiffstats
path: root/Doc/library/warnings.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-22 23:28:08 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-22 23:28:08 (GMT)
commite19558af1b6979edf27f7a05a6e47a8b5d113390 (patch)
treef901801a0684eba2f662670a178c43d96918c4db /Doc/library/warnings.rst
parent060f9bb6024580272440f57c612ca34d9beaa169 (diff)
downloadcpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.zip
cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.gz
cpython-e19558af1b6979edf27f7a05a6e47a8b5d113390.tar.bz2
Add a source parameter to warnings.warn()
Issue #26604: * Add a new optional source parameter to _warnings.warn() and warnings.warn() * Modify asyncore, asyncio and _pyio modules to set the source parameter when logging a ResourceWarning warning
Diffstat (limited to 'Doc/library/warnings.rst')
-rw-r--r--Doc/library/warnings.rst8
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst
index 4ce88ab..4fec365 100644
--- a/Doc/library/warnings.rst
+++ b/Doc/library/warnings.rst
@@ -300,7 +300,7 @@ Available Functions
-------------------
-.. function:: warn(message, category=None, stacklevel=1)
+.. function:: warn(message, category=None, stacklevel=1, source=None)
Issue a warning, or maybe ignore it or raise an exception. The *category*
argument, if given, must be a warning category class (see above); it defaults to
@@ -318,6 +318,12 @@ Available Functions
source of :func:`deprecation` itself (since the latter would defeat the purpose
of the warning message).
+ *source*, if supplied, is the destroyed object which emitted a
+ :exc:`ResourceWarning`.
+
+ .. versionchanged:: 3.6
+ Added *source* parameter.
+
.. function:: warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None, source=None)