[issue10053] Probably fd should not be closed when FileIO#__init__ failed
Hirokazu Yamamoto
report at bugs.python.org
Sat Oct 9 10:08:19 CEST 2010
New submission from Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>:
I suppose when _io.FileIO(fd) failed, passed fd
should not be closed. Otherwise, we cannot write the
code like this.
fd = os.open(path, os.O_RDONLY)
try:
buf = io.open(fd, "wb")
except:
os.close(fd)
raise
I found some corner case (rarely happens) in FileIO#__init__
Is this patch correct? Thank you.
----------
components: IO
files: py3k_ensure_fd_not_closed_after_fileio_init_failed.patch
keywords: patch
messages: 118249
nosy: ocean-city
priority: normal
severity: normal
stage: patch review
status: open
title: Probably fd should not be closed when FileIO#__init__ failed
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file19171/py3k_ensure_fd_not_closed_after_fileio_init_failed.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10053>
_______________________________________
More information about the Python-bugs-list
mailing list