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.

Author vstinner
Recipients ncoghlan, pitrou, serhiy.storchaka, vstinner
Date 2017-11-21.13:46:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511271963.98.0.213398074469.issue32089@psf.upfronthosting.co.za>
In-reply-to
Content
> If a program calls func() 1000 times in a row, they will show the same warning 1000 times.  What does it bring to have the exact same warning (and line number) displayed 1000 times instead of once? Nothing.  There is a reason the filter "default" isn't the same as "always", and it's that "always" can be completely overwhelming.

I don't know the rationale of the "always" action rather than "default". The choice was made 7 years ago, when Georg Brandl implemented the new ResourceWarning category: commit 08be72d0aa0112118b79d271479598c218adfd23.

The problem of ResourceWarning is that the warning logs where the last reference to the resource was cleared, or where the a garbage collection was triggered. Multiple resources can be created from different places, but all "die" at the same place.

In Python 3.6, I enhanced ResourceWarning to log also the traceback where the leaked resource has been created, if the tracemalloc is tracing memory allocations. When tracemalloc is used, it's useful to log ResourceWarning multiple times even if the warning itself is logged multipletimes. Well, that's an unusual usage of the ResourceWarning, we can also suggest to use -W always::ResourceWarning in that case.


> I don't agree with this.  You're comparing "-X dev" with a pydebug build of Python, not with a normal Python.

In general, I would like to offer the same experience in "development mode" (-X dev) and with a pydebug build.

For ResourceWarning, your rationale only concerns pydebug build, no?
History
Date User Action Args
2017-11-21 13:46:04vstinnersetrecipients: + vstinner, ncoghlan, pitrou, serhiy.storchaka
2017-11-21 13:46:03vstinnersetmessageid: <1511271963.98.0.213398074469.issue32089@psf.upfronthosting.co.za>
2017-11-21 13:46:03vstinnerlinkissue32089 messages
2017-11-21 13:46:03vstinnercreate