This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Silence DeprecationWarning by default
Type: behavior Stage: needs patch
Components: Interpreter Core Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: benjamin.peterson, brett.cannon, brian.curtin, ezio.melotti, flox, georg.brandl, pitrou
Priority: release blocker Keywords: patch

Created on 2009-11-14 00:15 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
silence_deprecations.diff brett.cannon, 2010-01-07 07:12
Messages (22)
msg95220 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-11-14 00:15
This issue is to track the silencing of DeprecationWarning by default.

To start a patch has been attached against trunk which silences 
DeprecationWarning. Documentation changes are still needed, though.
msg97189 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-01-04 02:47
New patch that includes proposed doc changes.
msg97217 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-04 15:47
Just FYI, there are tabs in your spaces in _warnings.c.
msg97227 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-01-04 22:22
The second paragraph ("There is also the issue...") is IMO redundant, especially the third sentence ("But because Python is an interpreted language...").
msg97243 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-01-05 02:27
warnings_rst_reword.diff proposes slightly different wording on the "Updating Code..." section of documentation.
msg97298 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-01-06 07:50
Thanks for the feedback, everyone. The tabs have been fixed in the source. As for the docs, I moved the explanation as to why the warnings are silenced to the end of the section and chopped the "compilation" reasoning as it is not the critical reason for the silencing.
msg97330 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-01-06 22:09
The wording of the documentation flows and is arranged better than before.

However, there is a test failure: test_exceptions.testDeprecatedMessageAttribute depends on the deprecation warning always occuring. 
@unittest.skipIf(DeprecationWarning in [filter[2] for filter in warnings.filters], "DeprecationWarning disabled") or something like that could avoid it.
msg97344 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-01-07 07:12
Latest patch adds fixes to test_exceptions test_ascii_formatd to pass.
msg97494 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-01-10 02:58
Committed in r77402. I am going to wait to see if any doc changes occur before I commit in py3k.

For historical reasons, here is the thread that hashed out the reasonsing:

And thanks to everyone who helped out with this!
msg98772 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-02-03 03:00
Has enough time elapsed yet for py3k merging?
msg98777 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-02-03 07:19
On Tue, Feb 2, 2010 at 19:00, Benjamin Peterson <> wrote:
> Benjamin Peterson <> added the comment:
> Has enough time elapsed yet for py3k merging?

Sure. I will try to do it before or at PyCon.
msg100522 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-03-06 09:38
The -Qwarn/-Qwarnall options are unexpectedly silenced in 2.7.
msg100541 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-03-06 19:19
So it isn't really unexpected as -Q uses DeprecationWarning which is being silenced by default.

So either -Q has to turn DeprecationWarning back on or a new subclass of DeprecationWarning (say IntegerDivisionWarning) needs to be introduced that -Q uses and adds to the warnings filter.

And FYI, I did backport the patch but forgot to close the issue.
msg100544 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-03-06 19:44
Posted to python-dev to solicit feedback on how to handle this.
msg101184 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-03-16 20:19
The silencing of DeprecationWarnings should also be advertised, so that who writes the code knows that now -Wd should be used explicitly while testing the code. A warning in the "What's new" would be a good place where to start.
msg102273 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-04-03 15:27
Lowering priority.
msg104174 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-04-25 22:34
-Q now works like -3 by causing the DeprecationWarning silencing to be skipped. Committed in r80492.
msg104177 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-04-25 22:46
This still hasn't been ported to py3.
msg104178 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-04-25 22:47
Making this a 3.2 issue now.
msg104180 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-04-25 22:58
Brett, by the way, you had spurious changes in subprocess in your last commit.
msg104183 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-04-25 23:12
I'm tired of svn. I swear I made sure I didn't list that file in what was changed.

Anyway, it's been reverted in r80496.
msg108809 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-06-28 00:05
Merged the lot in r82314.
Date User Action Args
2022-04-11 14:56:54adminsetnosy: + georg.brandl
github: 51568
2010-06-28 00:05:02benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg108809
2010-04-25 23:12:56brett.cannonsetmessages: + msg104183
2010-04-25 22:58:34benjamin.petersonsetmessages: + msg104180
2010-04-25 22:47:15brett.cannonsetmessages: + msg104178
versions: + Python 3.2, - Python 2.7
2010-04-25 22:46:00benjamin.petersonsetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg104177
2010-04-25 22:34:15brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg104174
2010-04-23 18:36:53brett.cannonsetpriority: critical -> release blocker
2010-04-03 15:27:13benjamin.petersonsetpriority: release blocker -> critical

messages: + msg102273
2010-03-16 20:19:02ezio.melottisetmessages: + msg101184
2010-03-06 19:44:01brett.cannonsetstage: commit review -> needs patch
messages: + msg100544
versions: - Python 3.2
2010-03-06 19:19:32brett.cannonsetmessages: + msg100541
2010-03-06 09:38:03floxsetversions: + Python 2.7
nosy: + flox

messages: + msg100522

stage: commit review
2010-02-03 07:19:37brett.cannonsetmessages: + msg98777
2010-02-03 03:00:32benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg98772
2010-01-10 02:58:08brett.cannonsetkeywords: - needs review

stage: patch review -> (no value)
messages: + msg97494
versions: - Python 2.7
2010-01-07 14:28:33brian.curtinsetfiles: - warnings_rst_reword.diff
2010-01-07 07:12:21brett.cannonsetfiles: + silence_deprecations.diff

messages: + msg97344
2010-01-07 07:11:35brett.cannonsetfiles: - silence_deprecations.diff
2010-01-06 22:09:45brian.curtinsetmessages: + msg97330
2010-01-06 07:50:21brett.cannonsetkeywords: + needs review
files: + silence_deprecations.diff
messages: + msg97298

stage: patch review
2010-01-06 07:48:05brett.cannonsetfiles: - silence_deprecations.diff
2010-01-06 06:57:02brett.cannonsetassignee: brett.cannon
2010-01-05 02:27:12brian.curtinsetfiles: + warnings_rst_reword.diff
nosy: + brian.curtin
messages: + msg97243

2010-01-04 22:22:52ezio.melottisetnosy: + ezio.melotti
messages: + msg97227
2010-01-04 15:47:35pitrousetnosy: + pitrou
messages: + msg97217
2010-01-04 02:48:06brett.cannonsetfiles: - silence_deprecations.diff
2010-01-04 02:47:56brett.cannonsetfiles: + silence_deprecations.diff

messages: + msg97189
2009-11-14 00:15:51brett.cannoncreate