Message157561
> 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.
changeset: 72456:0f5b64630fda
branch: 2.7
parent: 72450:c02e790c4535
user: Victor Stinner <[email protected]>
date: Fri Sep 23 19:37:03 2011 +0200
files: Doc/c-api/file.rst Lib/test/test_import.py Misc/NEWS
Objects/fileobject.c Python/import.c
description:
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). |
|
| Date |
User |
Action |
Args |
| 2012-04-05 11:20:08 | vstinner | set | recipients:
+ vstinner, doko, pitrou |
| 2012-04-05 11:20:07 | vstinner | link | issue14505 messages |
| 2012-04-05 11:20:07 | vstinner | create | |
|