Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3.5
Changeset: r95176:e6fcda16c6ae
Date: 2018-10-01 20:43 +0100
http://bitbucket.org/pypy/pypy/changeset/e6fcda16c6ae/

Log:    kill some PyFile_* functions thyat were removed in py3

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
@@ -41,19 +41,6 @@
     w_mode = space.newtext(rffi.charp2str(mode))
     return space.call_method(space.builtin, 'open', w_filename, w_mode)
 
-@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
-    pointer, fp.  The function close will be called when the file should be
-    closed.  Return NULL on failure."""
-    raise NotImplementedError
-
-@cpython_api([PyObject, rffi.INT_real], lltype.Void)
-def PyFile_SetBufSize(space, w_file, n):
-    """Available on systems with setvbuf() only.  This should only be called
-    immediately after file object creation."""
-    raise NotImplementedError
-
 @cpython_api([CONST_STRING, PyObject], rffi.INT_real, error=-1)
 def PyFile_WriteString(space, s, w_p):
     """Write string s to file object p.  Return 0 on success or -1 on
@@ -75,9 +62,3 @@
         w_str = space.repr(w_obj)
     space.call_method(w_p, "write", w_str)
     return 0
-
-@cpython_api([PyObject], PyObject)
-def PyFile_Name(space, w_p):
-    """Return the name of the file specified by p as a string object."""
-    w_name = space.getattr(w_p, space.newtext("name"))
-    return w_name     # borrowed ref, should be a W_StringObject from the file
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
@@ -48,17 +48,6 @@
 
         space.call_method(w_file, "close")
 
-    def test_file_name(self, space, api):
-        name = str(udir / "_test_file")
-        with rffi.scoped_str2charp(name) as filename:
-            with rffi.scoped_str2charp("wb") as mode:
-                w_file = api.PyFile_FromString(filename, mode)
-        assert space.str_w(api.PyFile_Name(w_file)) == name
-
-    @pytest.mark.xfail
-    def test_file_setbufsize(self, space, api):
-        api.PyFile_SetBufSize()
-
     def test_file_writestring(self, space, api, capfd):
         w_stdout = space.sys.get("stdout")
         with rffi.scoped_str2charp("test\n") as s:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to