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.
This commit is contained in:
Brett Cannon 2010-04-25 22:33:36 +00:00
parent a624040d72
commit 1994969c15
4 changed files with 47 additions and 23 deletions

View file

@ -384,7 +384,8 @@ except ImportError:
_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)