DeprecationWarning is now silent by default.
This was originally suggested by Guido, discussed on the stdlib-sig mailing
list, and given the OK by Guido directly to me. What this change essentially
means is that Python has taken a policy of silencing warnings that are only
of interest to developers by default. This should prevent users from seeing
warnings which are triggered by an application being run against a new
interpreter before the app developer has a chance to update their code.
Closes issue #7319. Thanks to Antoine Pitrou, Ezio Melotti, and Brian Curtin
for helping with the issue.
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 8d46cd6..a88e7ba 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -383,8 +383,8 @@
# Module initialization
_processoptions(sys.warnoptions)
if not _warnings_defaults:
- simplefilter("ignore", category=PendingDeprecationWarning, append=1)
- simplefilter("ignore", category=ImportWarning, append=1)
+ for cls in (DeprecationWarning, PendingDeprecationWarning, ImportWarning):
+ simplefilter("ignore", category=cls, append=True)
bytes_warning = sys.flags.bytes_warning
if bytes_warning > 1:
bytes_action = "error"