When DeprecationWarning was silenced by default, it also silenced any use of -Q
by default as well. This change fixes that by treating -Q like -3 when it comes
to DeprecationWarning; using it causes the silencing to not occur.
Fixes issue #7319.
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 134ba13..08b70af 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -384,7 +384,8 @@
_processoptions(sys.warnoptions)
if not _warnings_defaults:
silence = [ImportWarning, PendingDeprecationWarning]
- if not sys.py3kwarning: # Don't silence DeprecationWarning if -3 was used.
+ # Don't silence DeprecationWarning if -3 or -Q was used.
+ if not sys.py3kwarning and not sys.flags.division_warning:
silence.append(DeprecationWarning)
for cls in silence:
simplefilter("ignore", category=cls)