[issue14505] PyFile_FromString leaks file descriptors in python 2.7
report at bugs.python.org
Thu Apr 5 13:20:08 CEST 2012
STINNER Victor <victor.stinner at gmail.com> added the comment:
> Victor, that sounds like a strange behaviour to me.
We may change PyFile_FromString() to call fclose() when the file is
closed explicitly (call its close() method), but it may break backward
compatibility. I prefer to document the behaviour instead.
> PyFile_FromString is a public API and maybe it shouldn't
> have changed between 2.6 and 2.7.
PyFile_FromString() didn't change in Python 2.7.
I changed PyFile_FromFile() in Python 2.7 to fix the issue #7732.
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Fri Sep 23 19:37:03 2011 +0200
files: Doc/c-api/file.rst Lib/test/test_import.py Misc/NEWS
Issue #7732: Fix a crash on importing a module if a directory has the same name
than a Python module (e.g. "__init__.py"): don't close the file twice.
PyFile_FromFile() does also close the file if PyString_FromString() failed. It
did already close the file on fill_file_fields() error (e.g. if the file is a
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list