Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
I think while initializing it on the second call we just delete the handlers list variable which contains references to the file handlers instead of properly closing them like it's done in shutdown. handlers is a list of weakreferences and I don't know if they will close file handlers or other resources automatically as they are deleted. If the initialization is done in a loop involving threads then there might be others who are using the handlers as we delete them. The attached patch tries to close the handlers before deletion thus removing the warning. The same is observed in FileConfig too where handlers list is deleted before removal. shutdown method : https://github.com/python/cpython/blob/master/Lib/logging/__init__.py#L1994 deletion of handlers before closing them : https://github.com/python/cpython/blob/master/Lib/logging/config.py#L528 I think this is merged from Python 2.7 with commit https://github.com/python/cpython/commit/00ee7baf49430d8a6eed355a5fd7a05179325747 12 years back but doesn't produce any effect on Python 2.7 does -W all or -Wall have any effect ? Thanks ---------- keywords: +patch nosy: +xtreak Added file: https://bugs.python.org/file47656/33978.patch _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33978> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com