Commit 513b2658 authored by Matti Picus's avatar Matti Picus
Browse files

fix for 700c5913e7ea - force unbuffered FILE* use

parent 3c04fe2c5184
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.rfile import c_setvbuf, _IONBF
from pypy.module.cpyext.api import (
cpython_api, CANNOT_FAIL, CONST_STRING, FILEP, build_type_checkers, c_fdopen)
from pypy.module.cpyext.pyobject import PyObject
......@@ -67,9 +68,10 @@ def PyFile_AsFile(space, w_p):
ret = c_fdopen(fd, mode)
if not ret:
raise exception_from_saved_errno(space, space.w_IOError)
# XXX fix this once use-file-star-for-file lands
c_setvbuf(ret, lltype.nullptr(rffi.CCHARP.TO), _IONBF, 0)
return ret
@cpython_api([FILEP, CONST_STRING, CONST_STRING, rffi.VOIDP], PyObject)
def PyFile_FromFile(space, fp, name, mode, close):
"""Create a new PyFileObject from the already-open standard C file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment