diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-23 19:37:03 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-23 19:37:03 +0200 |
commit | 63c22fac727a72f0a4da8f72b12cd5f9b480376b (patch) | |
tree | 8c3da37f17c59c36e9204e527c1ceea2a48695f7 /Doc/c-api/file.rst | |
parent | 51b719814e0c32fd0eea570d3769d323bea97cab (diff) | |
download | cpython-git-63c22fac727a72f0a4da8f72b12cd5f9b480376b.tar.gz |
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
directory).
Diffstat (limited to 'Doc/c-api/file.rst')
-rw-r--r-- | Doc/c-api/file.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/c-api/file.rst b/Doc/c-api/file.rst index bdb8c49edd..93f6b64db2 100644 --- a/Doc/c-api/file.rst +++ b/Doc/c-api/file.rst @@ -55,7 +55,8 @@ change in future releases of Python. Create a new :ctype:`PyFileObject` from the already-open standard C file pointer, *fp*. The function *close* will be called when the file should be - closed. Return *NULL* on failure. + closed. Return *NULL* and close the file using *close* on failure. + *close* is optional and can be set to *NULL*. .. cfunction:: FILE* PyFile_AsFile(PyObject \*p) |