[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

Brock Mendel report at bugs.python.org
Wed Dec 4 12:19:31 EST 2019


Brock Mendel <jbrockmendel at gmail.com> added the comment:

> Does using with block similar to https://bugs.python.org/issue22831 solve this problem?

The motivating use case uses `with codecs.open(buf, "w", encoding=encoding) as f:`

https://github.com/pandas-dev/pandas/blob/master/pandas/io/formats/format.py#L498

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38971>
_______________________________________


More information about the Python-bugs-list mailing list