[Jython-checkins] jython: test_import runs on Windows. Fixes #3210.
jeff.allen
jython-checkins at python.org
Mon May 4 23:24:12 CEST 2015
https://hg.python.org/jython/rev/85f7eda810b2
changeset: 7699:85f7eda810b2
user: Jeff Allen <ja.py at farowl.co.uk>
date: Mon Apr 20 18:36:05 2015 +0100
summary:
test_import runs on Windows. Fixes #3210.
files:
Lib/test/symlink_support.py | 3 ++-
NEWS | 1 +
src/org/python/modules/posix/PosixModule.java | 8 +++++++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Lib/test/symlink_support.py b/Lib/test/symlink_support.py
--- a/Lib/test/symlink_support.py
+++ b/Lib/test/symlink_support.py
@@ -13,7 +13,8 @@
try:
symlink(TESTFN, symlink_path)
can = True
- except (OSError, NotImplementedError, AttributeError):
+ except (OSError, NotImplementedError, AttributeError, TypeError):
+ # Not allowed, not implemented, or symlink is None.
can = False
else:
os.remove(symlink_path)
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
- [ 2326 ] Java's weakly consistent iteration of ConcurrentMap is compatible with mutation
- [ 1572 ] sys-package-mgr console messages silenced by default. Thanks to Emmanuel Jannetti.
- [ 2332 ] jython -m test.regrtest -e now finds the tests it should.
+ - [ 2310 ] test_import runs on Windows (and passes with 4 skips).
Jython 2.7rc2
Bugs fixed
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
@@ -307,10 +307,16 @@
public static PyString __doc__chmod = new PyString(
"chmod(path, mode)\n\n" +
"Change the access permissions of a file.");
+
public static void chmod(PyObject path, int mode) {
if (os == OS.NT) {
try {
- if (!absolutePath(path).toFile().setWritable((mode & FileStat.S_IWUSR) != 0)) {
+ // We can only allow/deny write access (not read & execute)
+ boolean writable = (mode & FileStat.S_IWUSR) != 0;
+ File f = absolutePath(path).toFile();
+ if (!f.exists()) {
+ throw Py.OSError(Errno.ENOENT, path);
+ } else if (!f.setWritable(writable)) {
throw Py.OSError(Errno.EPERM, path);
}
} catch (SecurityException ex) {
--
Repository URL: https://hg.python.org/jython
More information about the Jython-checkins
mailing list