STINNER Victor <victor.stin...@gmail.com> added the comment:

> Lib/test/support/__init__.py::threading_cleanup() complains about dangling 
> threads even if the reference in question would be cleaned up by the garbage 
> collector.

It's a deliberate choice. It helped me to find real bugs. For example, I found 
a very old reference cycle in socket.create_connection().

The error message ("dangling threads") doesn't help, but it means that 
"something is wrong" in your test.

Sadly, sometimes you have to explicitly do something like "self.thread = None" 
in your test.

I wrote an article to explain these things:
https://vstinner.github.io/contrib-cpython-2017q3-part2.html

Instead of calling support.gc_collect(), I suggest to write documentation, 
maybe as a comment in support.threading_cleanup()?, explaining the warning and 
how to fix it. Maybe with a link to this issue? :-)

----------

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

Reply via email to