]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#6647: add note to two examples
authorAndrew M. Kuchling <amk@amk.ca>
Fri, 2 Apr 2010 17:54:26 +0000 (17:54 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Fri, 2 Apr 2010 17:54:26 +0000 (17:54 +0000)
Doc/library/warnings.rst

index 91ab0854b57a94f2b197b5803318d5f0ab6cae84..dbd563e52eb34c33402c2d8fa2b95f73f959fc5f 100644 (file)
@@ -173,7 +173,10 @@ the warning using the :class:`catch_warnings` context manager::
 While within the context manager all warnings will simply be ignored. This
 allows you to use known-deprecated code without having to see the warning while
 not suppressing the warning for other code that might not be aware of its use
-of deprecated code.
+of deprecated code.  Note: this can only be guaranteed in a single-threaded
+application. If two or more threads use the :class:`catch_warnings` context
+manager at the same time, the behavior is undefined.
+
 
 
 .. _warning-testing:
@@ -211,7 +214,9 @@ Once the context manager exits, the warnings filter is restored to its state
 when the context was entered. This prevents tests from changing the warnings
 filter in unexpected ways between tests and leading to indeterminate test
 results. The :func:`showwarning` function in the module is also restored to
-its original value.
+its original value.  Note: this can only be guaranteed in a single-threaded
+application. If two or more threads use the :class:`catch_warnings` context
+manager at the same time, the behavior is undefined.
 
 When testing multiple operations that raise the same kind of warning, it
 is important to test them in a manner that confirms each operation is raising