[Jython-checkins] jython (merge 2.5 -> default): merge with 2.5

philip.jenvey jython-checkins at python.org
Sat Apr 23 02:10:43 CEST 2011


http://hg.python.org/jython/rev/40e1d584f319
changeset:   6196:40e1d584f319
parent:      6193:ea5559c8b75b
parent:      6195:196a5e66a7bd
user:        Philip Jenvey <pjenvey at underboss.org>
date:        Fri Apr 22 17:08:27 2011 -0700
summary:
  merge with 2.5

files:
  Lib/test/test_fileno.py                       |  4 +++-
  NEWS                                          |  1 +
  src/org/python/modules/posix/PosixModule.java |  4 ++--
  3 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_fileno.py b/Lib/test/test_fileno.py
--- a/Lib/test/test_fileno.py
+++ b/Lib/test/test_fileno.py
@@ -46,7 +46,9 @@
         self.fp.write('jython filenos')
         self.fp.flush()
         self.fp.seek(0)
-        self.assertEqual(os.read(self.fd, 7), 'jython ')
+        result = os.read(self.fd, 7)
+        self.assertTrue(isinstance(result, str))
+        self.assertEqual(result, 'jython ')
         self.assertEqual(os.read(self.fd, 99), 'filenos')
         self.fp.close()
         raises(OSError, 9, os.read, self.fd, 1)
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
 Jython 2.6a1
   Bugs Fixed
     - [ 1727 ] Error in Jython 2.5.2 with os.stat and varargs
+    - [ 1735 ] return type of os.read is unicode, not str
   New Features
     - The Jython development repository has been converted from
       Subversion to Mercurial (almost)! A test repository is now
diff --git a/src/org/python/modules/posix/PosixModule.java b/src/org/python/modules/posix/PosixModule.java
--- a/src/org/python/modules/posix/PosixModule.java
+++ b/src/org/python/modules/posix/PosixModule.java
@@ -609,9 +609,9 @@
     public static PyString __doc__read = new PyString(
         "read(fd, buffersize) -> string\n\n" +
         "Read a file descriptor.");
-    public static String read(PyObject fd, int buffersize) {
+    public static PyObject read(PyObject fd, int buffersize) {
         try {
-            return StringUtil.fromBytes(FileDescriptors.get(fd).read(buffersize));
+            return new PyString(StringUtil.fromBytes(FileDescriptors.get(fd).read(buffersize)));
         } catch (PyException pye) {
             throw badFD();
         }

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


More information about the Jython-checkins mailing list