[New-bugs-announce] [issue28632] configparser does not close files in read

Petr report at bugs.python.org
Mon Nov 7 11:49:02 EST 2016


New submission from Petr:

When using configparser read method, the file(s) remains opened and cannot be closed, causing ResourceWarning: unclosed file.

For example in the following code:

config = configparser.ConfigParser()
config.read(cfg_fn)
...

the file cfg_fn remains opened and is only closed upon destruction of the underlying file object. At some point in history the method read used to close the file, but this has been changed for some reason.

----------
components: Library (Lib)
messages: 280209
nosy: PetrPy
priority: normal
severity: normal
status: open
title: configparser does not close files in read
type: resource usage
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28632>
_______________________________________


More information about the New-bugs-announce mailing list