mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
The silencing of DeprecationWarning was not taking -3 into consideration. Since
Py3K warnings are DeprecationWarning by default this was causing -3 to essentially be a no-op. Now DeprecationWarning is only silenced if -3 is not used. Closes issue #7700. Thanks Ezio Melotti and Florent Xicluna for patch help.
This commit is contained in:
parent
efdddd3370
commit
3ffa43db48
3 changed files with 25 additions and 15 deletions
|
@ -383,8 +383,11 @@ except ImportError:
|
|||
# Module initialization
|
||||
_processoptions(sys.warnoptions)
|
||||
if not _warnings_defaults:
|
||||
for cls in (DeprecationWarning, PendingDeprecationWarning, ImportWarning):
|
||||
simplefilter("ignore", category=cls, append=True)
|
||||
silence = [ImportWarning, PendingDeprecationWarning]
|
||||
if not sys.py3kwarning: # Don't silence DeprecationWarning if -3 was used.
|
||||
silence.append(DeprecationWarning)
|
||||
for cls in silence:
|
||||
simplefilter("ignore", category=cls)
|
||||
bytes_warning = sys.flags.bytes_warning
|
||||
if bytes_warning > 1:
|
||||
bytes_action = "error"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue