[pypy-commit] pypy feature_closed_prop_to_rfile: RFile; added property .closed to mirror standard `file` behaviour.

Bystroushaak pypy.commits at gmail.com
Tue Jul 30 14:23:27 EDT 2019


Author: Bystroushaak <bystrousak at kitakitsune.org>
Branch: feature_closed_prop_to_rfile
Changeset: r97034:5f379993c867
Date: 2019-07-09 17:26 +0200
http://bitbucket.org/pypy/pypy/changeset/5f379993c867/

Log:	RFile; added property .closed to mirror standard `file` behaviour.

diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -312,6 +312,10 @@
         if not self._ll_file:
             raise ValueError("I/O operation on closed file")
 
+    @property
+    def closed(self):
+        return not self._ll_file
+
     def _fread(self, buf, n, stream):
         if not self._univ_newline:
             return c_fread(buf, 1, n, stream)


More information about the pypy-commit mailing list