[Jython-checkins] jython: Fix counting bug in _io.PyIOBase.readline
jeff.allen
jython-checkins at python.org
Mon Feb 18 09:01:00 CET 2013
http://hg.python.org/jython/rev/f6f92f896ffd
changeset: 7056:f6f92f896ffd
parent: 7049:1af38173c96d
user: Jeff Allen <ja...py at farowl.co.uk>
date: Tue Feb 12 23:58:41 2013 +0000
summary:
Fix counting bug in _io.PyIOBase.readline
Discovered by test_memoryio test_readline. Now can remove
skip. Also re-worked skip for test_detach to cite Issue 1996.
files:
Lib/test/test_memoryio.py | 20 ++++++------
src/org/python/modules/_io/PyIOBase.java | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
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
@@ -60,11 +60,6 @@
class MemoryTestMixin:
- # 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_detach(self):
buf = self.ioclass()
self.assertRaises(self.UnsupportedOperation, buf.detach)
@@ -179,11 +174,6 @@
memio.close()
self.assertRaises(ValueError, memio.read)
- # 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_readline(self):
buf = self.buftype("1234567890\n")
memio = self.ioclass(buf * 2)
@@ -413,6 +403,13 @@
UnsupportedOperation = pyio.UnsupportedOperation
+ # When Jython tries to use UnsupportedOperation as _pyio defines it, it runs
+ # into a problem with multiple inheritance and the slots array: issue 1996.
+ # Override the affected test version just so we can skip it visibly.
+ @unittest.skipIf(support.is_jython, "FIXME: Jython issue 1996")
+ def test_detach(self):
+ pass
+
@staticmethod
def buftype(s):
return s.encode("ascii")
@@ -631,6 +628,9 @@
"array.array() does not have the new buffer API"
)(PyBytesIOTest.test_bytes_array)
+ # Re-instate test_detach skipped by Jython in PyBytesIOTest
+ if support.is_jython: # FIXME: Jython issue 1996
+ test_detach = MemoryTestMixin.test_detach
# This test isn't working on Ubuntu on an Apple Intel powerbook,
# Jython 2.7b1+ (default:6b4a1088566e, Feb 10 2013, 14:36:47)
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
@@ -591,7 +591,7 @@
*/
PyByteArray res = new PyByteArray();
- while (remainingLimit > 0) {
+ while (--remainingLimit >= 0) {
/*
* read() returns a str of one byte, doing at most one read to refill, or it returns
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list