This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Trundle, amaury.forgeotdarc, brett.cannon, doko, flox, l0nwlf, ncoghlan, orsenthil, r.david.murray
Date 2010-04-09.08:55:29
SpamBayes Score 7.2794766e-09
Marked as misclassified No
Message-id <1270803331.92.0.985671327492.issue7732@psf.upfronthosting.co.za>
In-reply-to
Content
An interesting part of this story is *why* it doesn't crash in Py3k (despite explicitly closing the file descriptor in the same way as 2.x closes the C file pointer).

The reason is that PyFile_FromFd (the closest Py3k equivalent to PyFile_FromFile) will sometimes leave the file descriptor open, even if closefd is True. Specifically, this will happen if the raw file IO object fails to be created. Any subsequent failure while opening the file (e.g. while creating the line buffering or text wrapper) will trigger the same double close bug as occurs in 2.x.

io_open needs to be fixed so this behaviour is consistent: if creation of the raw file IO object fails and closefd is True, io_open should close the file descriptor so that the behaviour on error is consistent.
History
Date User Action Args
2010-04-09 08:55:32ncoghlansetrecipients: + ncoghlan, brett.cannon, doko, amaury.forgeotdarc, orsenthil, r.david.murray, Trundle, flox, l0nwlf
2010-04-09 08:55:31ncoghlansetmessageid: <1270803331.92.0.985671327492.issue7732@psf.upfronthosting.co.za>
2010-04-09 08:55:30ncoghlanlinkissue7732 messages
2010-04-09 08:55:29ncoghlancreate