[issue10053] Probably fd should not be closed when FileIO#__init__ failed

2010-10-09 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Here is the test script also run on py2.7. -- Added file: http://bugs.python.org/file19172/test_ensure_fd_not_closed_after_fileio_init_failed.py ___ Python tracker ___

[issue10053] Probably fd should not be closed when FileIO#__init__ failed

2010-10-09 Thread Hirokazu Yamamoto
New submission from Hirokazu Yamamoto : 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