[pypy-commit] pypy default: need to clear file error here

bdkearns noreply at buildbot.pypy.org
Tue Sep 9 01:37:22 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r73384:369f2b3d76f7
Date: 2014-09-08 13:58 -0400
http://bitbucket.org/pypy/pypy/changeset/369f2b3d76f7/

Log:	need to clear file error here

diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -343,6 +343,7 @@
             bytes = c_fwrite(ll_value, 1, length, self._ll_file)
             if bytes != length:
                 errno = rposix.get_errno()
+                c_clearerr(self._ll_file)
                 raise IOError(errno, os.strerror(errno))
         finally:
             rffi.free_nonmovingbuffer(value, ll_value)
diff --git a/rpython/rlib/test/test_rfile.py b/rpython/rlib/test/test_rfile.py
--- a/rpython/rlib/test/test_rfile.py
+++ b/rpython/rlib/test/test_rfile.py
@@ -143,7 +143,7 @@
             for mode in ['r', 'U']:
                 f2 = open(fname, mode)
                 try:
-                    f2.write('')
+                    f2.write('z')
                 except IOError as e:
                     pass
                 else:


More information about the pypy-commit mailing list