Author: Matti Picus <matti.pi...@gmail.com> Branch: pyfile-tell Changeset: r85207:48f59a7416c9 Date: 2016-06-17 09:10 +0300 http://bitbucket.org/pypy/pypy/changeset/48f59a7416c9/
Log: add flush_buffers to PyFile_AsFile diff --git a/pypy/module/cpyext/pyfile.py b/pypy/module/cpyext/pyfile.py --- a/pypy/module/cpyext/pyfile.py +++ b/pypy/module/cpyext/pyfile.py @@ -55,6 +55,7 @@ if not PyFile_Check(space, w_p): raise oefmt(space.w_IOError, 'first argument must be an open file') assert isinstance(w_p, W_File) + w_p.stream.flush_buffers() try: fd = space.int_w(space.call_method(w_p, 'fileno')) mode = w_p.mode diff --git a/pypy/module/cpyext/test/test_pyfile.py b/pypy/module/cpyext/test/test_pyfile.py --- a/pypy/module/cpyext/test/test_pyfile.py +++ b/pypy/module/cpyext/test/test_pyfile.py @@ -142,9 +142,5 @@ t_py = fid.tell() assert t_py == 80 t_c = module.get_c_tell(fid) - # XXX currently fails since rlib/streamio BufferingInputStream has - # an internal readahead buffer self.buf and its self.pos can be - # out of sync with the underlying c-level FILE * (it's not called - # a BufferingInputStream for nothing) assert t_c == t_py _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit