mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
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.
This commit is contained in:
parent
3ad57e2625
commit
6fdd3dcb6a
6 changed files with 65 additions and 31 deletions
|
@ -383,8 +383,8 @@ except ImportError:
|
|||
# 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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue