From: <pj...@us...> - 2011-04-03 00:55:29
|
Revision: 7285 http://jython.svn.sourceforge.net/jython/?rev=7285&view=rev Author: pjenvey Date: 2011-04-03 00:55:23 +0000 (Sun, 03 Apr 2011) Log Message: ----------- fix os.stat(*(path,)) (when called with varargs, #1727) fix from agronholm Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/modules/posix/PosixModule.java Added Paths: ----------- trunk/jython/Lib/test/test_os_jy.py Added: trunk/jython/Lib/test/test_os_jy.py =================================================================== --- trunk/jython/Lib/test/test_os_jy.py (rev 0) +++ trunk/jython/Lib/test/test_os_jy.py 2011-04-03 00:55:23 UTC (rev 7285) @@ -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: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-04-01 18:58:57 UTC (rev 7284) +++ trunk/jython/NEWS 2011-04-03 00:55:23 UTC (rev 7285) @@ -1,5 +1,9 @@ Jython NEWS +Jython 2.6a1 + Bugs Fixed + - [ 1727 ] Error in Jython 2.5.2 with os.stat and varargs + Jython 2.5.2 same as 2.5.2rc4 Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2011-04-01 18:58:57 UTC (rev 7284) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2011-04-03 00:55:23 UTC (rev 7285) @@ -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. |