[Jython-checkins] jython: Remove check for closed from _jyio.TextIOWrapper

jeff.allen jython-checkins at python.org
Mon Feb 18 09:01:06 CET 2013


http://hg.python.org/jython/rev/e51ba816e845
changeset:   7060:e51ba816e845
user:        Jeff Allen <ja...py at farowl.co.uk>
date:        Sat Feb 16 09:50:29 2013 +0000
summary:
  Remove check for closed from _jyio.TextIOWrapper
Only flush should be checked, and that now happens in PyIOBase.

files:
  Lib/_jyio.py                             |  6 +-----
  Lib/test/test_memoryio.py                |  5 -----
  src/org/python/modules/_io/PyIOBase.java |  5 ++++-
  3 files changed, 5 insertions(+), 11 deletions(-)


diff --git a/Lib/_jyio.py b/Lib/_jyio.py
--- a/Lib/_jyio.py
+++ b/Lib/_jyio.py
@@ -1042,22 +1042,18 @@
 
     def seekable(self):
         self._checkInitialized()    # Jython: to forbid use in an invalid state
-        self._checkClosed()         # Jython: compatibility with C implementation
         return self._seekable
 
     def readable(self):
         self._checkInitialized()    # Jython: to forbid use in an invalid state
-        self._checkClosed()         # Jython: compatibility with C implementation
         return self.buffer.readable()
 
     def writable(self):
         self._checkInitialized()    # Jython: to forbid use in an invalid state
-        self._checkClosed()         # Jython: compatibility with C implementation
         return self.buffer.writable()
 
     def flush(self):
-        self._checkInitialized()       # Jython: to forbid use in an invalid state
-        self._checkClosed()         # Jython: compatibility with C implementation
+        self._checkInitialized()    # Jython: to forbid use in an invalid state
         self.buffer.flush()
         self._telling = self._seekable
 
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -319,11 +319,6 @@
 
         self.assertEqual(memio.flush(), None)
 
-    # This test isn't working on Ubuntu on an Apple Intel powerbook,
-    # Jython 2.7b1+ (default:6b4a1088566e, Feb 10 2013, 14:36:47) 
-    # [OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_09
-    @unittest.skipIf(support.is_jython,
-                     "FIXME: Currently not working on jython")
     def test_flags(self):
         memio = self.ioclass()
 
diff --git a/src/org/python/modules/_io/PyIOBase.java b/src/org/python/modules/_io/PyIOBase.java
--- a/src/org/python/modules/_io/PyIOBase.java
+++ b/src/org/python/modules/_io/PyIOBase.java
@@ -181,7 +181,10 @@
     }
 
     @ExposedMethod(doc = flush_doc)
-    final void _IOBase_flush() {}
+    final void _IOBase_flush() {
+        // Even types for which this remains a no-op must complain if closed (e.g. BytesIO)
+        _checkClosed();
+    }
 
     /**
      * True if the object is closed to further <b>client</b> operations. It is the state accessed by

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list