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 asvetlov, methane, thehesiod, vstinner
Date 2018-05-23.14:31:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527085914.37.0.682650639539.issue33565@psf.upfronthosting.co.za>
In-reply-to
Content
> Hmm, GH-4587 is merged in 3.6 branch in last November, but 3.6.5 doesn't include it?

We decided to not fix the memory leak in Python 3.6:
https://github.com/python/cpython/pull/4587#issuecomment-347659163

"""
This change makes warning.warn() 1.4x slower on Python 3.6 for the ignore action: https://bugs.python.org/issue27535#msg307165

I don't think that the memory leak issue is important enough to justify such slowdown in a stable branch. So I close my PR.
"""

So yes, this issue is a bug in Python: it's bpo-27535. It's a bug in the _warnings module. tracemalloc only tells you the truth, it's just that it's hard to understand the output :-)

The bug occurs when you get ResourceWarning warnings. Such warning means that the code has a bug: the bug should be fixed. If you fix the ResourceWarning, the bug should disappear.

As Naoki INADA wrote: use python3 -Walways (I prefer python3 -Wdefault, but it's almost the same ;-)) to see such warnings.

Python 3.7 comes with a new -X dev option which enables these warnings but also other runtime checks to ease development.

I suggest to close this issue as a duplicate of bpo-27535.

Thanks Alexander Mohr for your bug report, and good luck to fix your warning ;-) If you are motivated, you can propose changes to the tracemalloc documentation!
History
Date User Action Args
2018-05-23 14:31:54vstinnersetrecipients: + vstinner, asvetlov, methane, thehesiod
2018-05-23 14:31:54vstinnersetmessageid: <1527085914.37.0.682650639539.issue33565@psf.upfronthosting.co.za>
2018-05-23 14:31:54vstinnerlinkissue33565 messages
2018-05-23 14:31:54vstinnercreate