New submission from Géry <gery.o...@gmail.com>:

Calling logging.config.dictConfig several times with a file handler in the same 
Python process leaks resources.

INPUT:

$ python3 -Wall <<EOF
import logging.config

config = {
    "version": 1,
    "handlers": {
        "file": {
            "class": "logging.FileHandler",
            "filename": "test.log"
        }
    },
    "root": {
        "handlers": ["file"]
    }
}
logging.config.dictConfig(config)
logging.config.dictConfig(config)
EOF

OUTPUT:

/usr/lib/python3.6/logging/config.py:789: ResourceWarning: unclosed file 
<_io.TextIOWrapper name='/home/maggyero/test.log' mode='a' encoding='UTF-8'>
  self.common_logger_config(root, config, incremental)

----------
components: Library (Lib)
messages: 320560
nosy: maggyero
priority: normal
severity: normal
status: open
title: logging.config.dictConfig with file handler leaks resources
type: resource usage
versions: Python 3.6

_______________________________________
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

Reply via email to