STINNER Victor <vstin...@redhat.com> added the comment:

> 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!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33565>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to