[pypy-commit] pypy Anthony-Sottile/fix-leak-of-file-descriptor-with-_iofile-1559687440863: Fix leak of file descriptor with `_io.FileIO('dir/')`

asottile pypy.commits at gmail.com
Wed Jun 5 01:51:28 EDT 2019


Author: Anthony Sottile <asottile at umich.edu>
Branch: Anthony-Sottile/fix-leak-of-file-descriptor-with-_iofile-1559687440863
Changeset: r96743:bb17c9943258
Date: 2019-06-04 22:35 +0000
http://bitbucket.org/pypy/pypy/changeset/bb17c9943258/

Log:	Fix leak of file descriptor with `_io.FileIO('dir/')`

diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -256,6 +256,7 @@
         except:
             if not fd_is_own:
                 self.fd = -1
+            self._close(space)
             raise
 
     def _mode(self):


More information about the pypy-commit mailing list