Issue2083
Created on 2013-09-05.13:24:21 by cdleonard, last changed 2013-12-22.17:57:20 by jeff.allen.
File name |
Uploaded |
Description |
Edit |
Remove |
issue2083.patch
|
santa4nt,
2013-09-05.20:04:11
|
Raise an exception when os.unlink() is called with a directory path. |
|
|
msg8100 (view) |
Author: Leonard Crestez (cdleonard) |
Date: 2013-09-05.13:24:21 |
|
Here is some very simple sample code:
import os
from tempfile import mkdtemp
tempdir = mkdtemp()
print "temp is %r" % tempdir
os.unlink(tempdir)
This throws an exception on cpython (OSError with errno EISDIR) but succeeds on jython.
|
msg8101 (view) |
Author: Santoso Wijaya (santa4nt) |
Date: 2013-09-05.20:04:11 |
|
This is because the Java API used, File#delete() [1] does not distinguish between files and directories, unlike the semantics of os.unlink().
Attaching a simple fix.
[1] http://docs.oracle.com/javase/7/docs/api/java/io/File.html#delete()
|
msg8208 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2013-12-21.22:50:48 |
|
I have tried this out locally and it seems fine.
I have added a test for OSError thrown to test.test_os_jy (which fails before the patch is applied) and a NEWS entry. Regression tests run with no new failures.
I will commit the whole as one change set in Santoso's name. Thanks for this!
|
msg8210 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2013-12-22.17:57:20 |
|
Now resolved at http://hg.python.org/jython/rev/dc9b1aa30f6d thanks to this patch.
|
|
Date |
User |
Action |
Args |
2013-12-22 17:57:20 | jeff.allen | set | status: open -> closed resolution: fixed messages:
+ msg8210 |
2013-12-21 22:50:49 | jeff.allen | set | assignee: jeff.allen messages:
+ msg8208 nosy:
+ jeff.allen |
2013-09-05 20:04:17 | santa4nt | set | type: behaviour components:
+ Core |
2013-09-05 20:04:12 | santa4nt | set | files:
+ issue2083.patch keywords:
+ patch messages:
+ msg8101 nosy:
+ santa4nt |
2013-09-05 13:24:21 | cdleonard | create | |
|