[pypy-commit] pypy default: fix 57ee4821e42c differently

mattip pypy.commits at gmail.com
Mon Nov 7 12:31:40 EST 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r88189:fe2af558d879
Date: 2016-11-07 19:28 +0200
http://bitbucket.org/pypy/pypy/changeset/fe2af558d879/

Log:	fix 57ee4821e42c differently

diff --git a/pypy/module/cpyext/test/test_eval.py b/pypy/module/cpyext/test/test_eval.py
--- a/pypy/module/cpyext/test/test_eval.py
+++ b/pypy/module/cpyext/test/test_eval.py
@@ -3,7 +3,8 @@
 from pypy.module.cpyext.test.test_api import BaseApiTest
 from pypy.module.cpyext.eval import (
     Py_single_input, Py_file_input, Py_eval_input, PyCompilerFlags)
-from pypy.module.cpyext.api import c_fopen, c_fclose, c_fileno, Py_ssize_tP
+from pypy.module.cpyext.api import (c_fopen, c_fclose, c_fileno, 
+                Py_ssize_tP, is_valid_fd)
 from pypy.interpreter.gateway import interp2app
 from pypy.interpreter.astcompiler import consts
 from rpython.tool.udir import udir
@@ -140,8 +141,10 @@
 
         # try again, but with a closed file
         fp = c_fopen(str(filepath), "rb")
-        c_fclose(fp)
+        os.close(c_fileno(fp))
         api.PyRun_File(fp, filename, Py_file_input, w_globals, w_locals)
+        if is_valid_fd(c_fileno(fp)):
+            c_fclose(fp)
         assert api.PyErr_Occurred() is space.w_IOError
         api.PyErr_Clear()
 


More information about the pypy-commit mailing list