[pypy-commit] pypy use-file-star-for-file: fixes for rfile setbufsize

bdkearns noreply at buildbot.pypy.org
Thu Sep 11 22:50:38 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: use-file-star-for-file
Changeset: r73482:aa030b8c29a6
Date: 2014-09-11 16:49 -0400
http://bitbucket.org/pypy/pypy/changeset/aa030b8c29a6/

Log:	fixes for rfile setbufsize

diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -73,9 +73,6 @@
                       [rffi.INT, rffi.CCHARP], FILEP)
 c_tmpfile = llexternal('tmpfile', [], FILEP)
 
-c_setvbuf = llexternal('setvbuf', [FILEP, rffi.CCHARP, rffi.INT, rffi.SIZE_T],
-                       rffi.INT)
-
 # Note: the following functions are called from __del__ methods,
 # so must be 'releasegil=False'.  Otherwise, a program using both
 # threads and the RFile class cannot translate.  See c684bf704d1f
@@ -110,6 +107,8 @@
 c_feof = llexternal('feof', [FILEP], rffi.INT, releasegil=False)
 c_ferror = llexternal('ferror', [FILEP], rffi.INT, releasegil=False)
 c_clearerr = llexternal('clearerr', [FILEP], lltype.Void, releasegil=False)
+c_setvbuf = llexternal('setvbuf', [FILEP, rffi.CCHARP, rffi.INT, rffi.SIZE_T],
+                       rffi.INT, releasegil=False)
 
 c_stdin = llexternal('get_stdin', [], FILEP, _nowrapper=True)
 c_stdout = llexternal('get_stdout', [], FILEP, _nowrapper=True)
@@ -254,6 +253,7 @@
                 bufsize = BUFSIZ
             else:
                 mode = _IOFBF
+            c_fflush_nogil(self._ll_file)
             if self._setbuf:
                 lltype.free(self._setbuf, flavor='raw')
             if mode == _IONBF:


More information about the pypy-commit mailing list