[Jython-checkins] jython (2.5): fix os.link silently failing
philip.jenvey
jython-checkins at python.org
Tue Nov 29 19:32:51 CET 2011
http://hg.python.org/jython/rev/ef1eb2bc70f5
changeset: 6283:ef1eb2bc70f5
branch: 2.5
parent: 6281:4d0f8af76d2d
user: Philip Jenvey <pjenvey at underboss.org>
date: Tue Nov 29 10:31:53 2011 -0800
summary:
fix os.link silently failing
files:
Lib/test/test_os_jy.py | 5 +++++
NEWS | 1 +
src/org/python/modules/posix/PosixModule.java | 4 +++-
3 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_os_jy.py b/Lib/test/test_os_jy.py
--- a/Lib/test/test_os_jy.py
+++ b/Lib/test/test_os_jy.py
@@ -22,6 +22,11 @@
os.remove(test_support.TESTFN)
self.assertRaises(OSError, os.utime, test_support.TESTFN, None)
+ def test_issue1824(self):
+ os.remove(test_support.TESTFN)
+ self.assertRaises(OSError, os.link,
+ test_support.TESTFN, test_support.TESTFN)
+
def test_main():
test_support.run_unittest(OSTestCase)
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@
- [ 1809 ] socket.getaddrinfo sometimes returns an object that crashes in __str__
- [ 1811 ] Recursive import bug w/ SQLAlchemy 0.7.3
- [ 1819 ] Incorrect handling of Java object toString methods returning null
+ - [ 1824 ] os.link() can silently fail
Jython 2.5.2
same as 2.5.2rc4
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
@@ -464,7 +464,9 @@
"Create a hard link to a file.");
@Hide(OS.NT)
public static void link(String src, String dst) {
- posix.link(absolutePath(src), absolutePath(dst));
+ if (posix.link(absolutePath(src), absolutePath(dst)) < 0) {
+ throw errorFromErrno();
+ }
}
public static PyString __doc__listdir = new PyString(
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list