SF.net SVN: jython:[7286] branches/Release_2_5maint

[email protected] Sun, 03 Apr 2011 00:59:12 +0000
Newsgroups gmane.comp.lang.jython.cvs
Message-ID <[email protected]>
Revision: 7286
          http://jython.svn.sourceforge.net/jython/?rev=7286&view=rev
Author:   pjenvey
Date:     2011-04-03 00:59:11 +0000 (Sun, 03 Apr 2011)

Log Message:
-----------
Merged revisions 7285 via svnmerge from 
https://jython.svn.sourceforge.net/svnroot/jython/trunk

........
  r7285 | pjenvey | 2011-04-02 17:55:23 -0700 (Sat, 02 Apr 2011) | 3 lines
  
  fix os.stat(*(path,)) (when called with varargs, #1727)
  fix from agronholm
........

Modified Paths:
--------------
    branches/Release_2_5maint/jython/NEWS
    branches/Release_2_5maint/jython/src/org/python/modules/posix/PosixModule.java

Added Paths:
-----------
    branches/Release_2_5maint/jython/Lib/test/test_os_jy.py

Property Changed:
----------------
    branches/Release_2_5maint/
    branches/Release_2_5maint/jython/


Property changes on: branches/Release_2_5maint
___________________________________________________________________
Modified: svnmerge-integrated
   - /trunk:1-7207,7210
   + /trunk:1-7207,7210,7285
Modified: svn:mergeinfo
   - /trunk:7210
   + /trunk:7210,7285


Property changes on: branches/Release_2_5maint/jython
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/jsr223:6285-6565
/branches/newstyle-java-types:5564-5663,5666-5729
/trunk/jython:7210
   + /branches/jsr223:6285-6565
/branches/newstyle-java-types:5564-5663,5666-5729
/trunk/jython:7210,7285

Copied: branches/Release_2_5maint/jython/Lib/test/test_os_jy.py (from rev 7285, trunk/jython/Lib/test/test_os_jy.py)
===================================================================
--- branches/Release_2_5maint/jython/Lib/test/test_os_jy.py	                        (rev 0)
+++ branches/Release_2_5maint/jython/Lib/test/test_os_jy.py	2011-04-03 00:59:11 UTC (rev 7286)
@@ -0,0 +1,26 @@
+"""Misc os module tests
+
+Made for Jython.
+"""
+import os
+import unittest
+from test import test_support
+
+class OSTestCase(unittest.TestCase):
+
+    def setUp(self):
+        open(test_support.TESTFN, 'w').close()
+
+    def tearDown(self):
+        os.remove(test_support.TESTFN)
+
+    def test_issue1727(self):
+        os.stat(*(test_support.TESTFN,))
+
+
+def test_main():
+    test_support.run_unittest(OSTestCase)
+
+
+if __name__ == '__main__':
+    test_main()

Modified: branches/Release_2_5maint/jython/NEWS
===================================================================
--- branches/Release_2_5maint/jython/NEWS	2011-04-03 00:55:23 UTC (rev 7285)
+++ branches/Release_2_5maint/jython/NEWS	2011-04-03 00:59:11 UTC (rev 7286)
@@ -1,5 +1,9 @@
 Jython NEWS
 
+Jython 2.5.3a1
+  Bugs Fixed
+    - [ 1727 ] Error in Jython 2.5.2 with os.stat and varargs
+
 Jython 2.5.2
   same as 2.5.2rc4
 

Modified: branches/Release_2_5maint/jython/src/org/python/modules/posix/PosixModule.java
===================================================================
--- branches/Release_2_5maint/jython/src/org/python/modules/posix/PosixModule.java	2011-04-03 00:55:23 UTC (rev 7285)
+++ branches/Release_2_5maint/jython/src/org/python/modules/posix/PosixModule.java	2011-04-03 00:59:11 UTC (rev 7286)
@@ -24,7 +24,7 @@
 
 import org.python.core.ClassDictInit;
 import org.python.core.Py;
-import org.python.core.PyBuiltinFunction;
+import org.python.core.PyBuiltinFunctionNarrow;
 import org.python.core.PyDictionary;
 import org.python.core.PyException;
 import org.python.core.PyFile;
@@ -34,7 +34,6 @@
 import org.python.core.PyObject;
 import org.python.core.PyString;
 import org.python.core.PyTuple;
-import org.python.core.ThreadState;
 import org.python.core.imp;
 import org.python.core.io.IOBase;
 import org.python.core.io.FileDescriptors;
@@ -929,15 +928,15 @@
         return os.getModuleName();
     }
 
-    static class LstatFunction extends PyBuiltinFunction {
+    static class LstatFunction extends PyBuiltinFunctionNarrow {
         LstatFunction() {
-            super("lstat",
+            super("lstat", 1, 1,
                   "lstat(path) -> stat result\n\n" +
                   "Like stat(path), but do not follow symbolic links.");
         }
 
         @Override
-        public PyObject __call__(ThreadState state, PyObject pathObj) {
+        public PyObject __call__(PyObject pathObj) {
             if (!(pathObj instanceof PyString)) {
                 throw Py.TypeError(String.format("coercing to Unicode: need string or buffer, %s " +
                                                  "found", pathObj.getType().fastGetName()));
@@ -947,9 +946,9 @@
         }
     }
 
-    static class StatFunction extends PyBuiltinFunction {
+    static class StatFunction extends PyBuiltinFunctionNarrow {
         StatFunction() {
-            super("stat",
+            super("stat", 1, 1,
                   "stat(path) -> stat result\n\n" +
                   "Perform a stat system call on the given path.\n\n" +
                   "Note that some platforms may return only a small subset of the\n" +
@@ -957,7 +956,7 @@
         }
 
         @Override
-        public PyObject __call__(ThreadState state, PyObject pathObj) {
+        public PyObject __call__(PyObject pathObj) {
             if (!(pathObj instanceof PyString)) {
                 throw Py.TypeError(String.format("coercing to Unicode: need string or buffer, %s " +
                                                  "found", pathObj.getType().fastGetName()));


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf