New submission from Hirokazu Yamamoto <ocean-c...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue10053> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com