Author: Amaury Forgeot d'Arc <[email protected]>
Branch: 
Changeset: r65092:e83efe56cd20
Date: 2013-06-29 12:16 +0200
http://bitbucket.org/pypy/pypy/changeset/e83efe56cd20/

Log:    Issue1392: Implement IOBase._checkClosed().

        Patch by limeburst.

diff --git a/pypy/module/_io/interp_iobase.py b/pypy/module/_io/interp_iobase.py
--- a/pypy/module/_io/interp_iobase.py
+++ b/pypy/module/_io/interp_iobase.py
@@ -101,6 +101,9 @@
             raise OperationError(
                 space.w_ValueError, space.wrap(message))
 
+    def check_closed_w(self, space):
+        self._check_closed(space)
+
     def closed_get_w(self, space):
         return space.newbool(self.__IOBase_closed)
 
@@ -277,6 +280,7 @@
     _checkReadable = interp2app(check_readable_w),
     _checkWritable = interp2app(check_writable_w),
     _checkSeekable = interp2app(check_seekable_w),
+    _checkClosed = interp2app(W_IOBase.check_closed_w),
     closed = GetSetProperty(W_IOBase.closed_get_w),
     __dict__ = GetSetProperty(descr_get_dict, descr_set_dict, cls=W_IOBase),
     __weakref__ = make_weakref_descr(W_IOBase),
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -22,7 +22,9 @@
         import io
         with io.BufferedIOBase() as f:
             assert not f.closed
+            f._checkClosed()
         assert f.closed
+        raises(ValueError, f._checkClosed)
 
     def test_iter(self):
         import io
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to