Martin Panter added the comment:

Without more information about what the relevant code is and why you think the 
line number is wrong, my best guess is you may not realize how the 
ResourceWarning is emitted. It happens when the garbage collector runs and 
destroys the socket object, which happens sometime after the last reference to 
the socket has been deleted. So the line number can be rather arbitrary, 
especially if it was a reference cycle that triggered the garbage collector.

If you are having trouble tracking down what socket is involved, the new 
“python -X tracemalloc=<N>” option 
<https://docs.python.org/3/whatsnew/3.6.html#warnings> may help. It saves stack 
traces when objects are created.

----------
nosy: +martin.panter
stage:  -> test needed

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

Reply via email to