diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-10-31 21:47:43 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-10-31 21:47:43 (GMT) |
commit | afe170645753d73b9ce49c7791fbeab15f6d0fc7 (patch) | |
tree | 34f03ba946317a4352235e1f24af2907299e2eca /Modules/posixmodule.c | |
parent | a0c811e439d299c5647a93e9f76b45d76a6796ec (diff) | |
download | cpython-afe170645753d73b9ce49c7791fbeab15f6d0fc7.zip cpython-afe170645753d73b9ce49c7791fbeab15f6d0fc7.tar.gz cpython-afe170645753d73b9ce49c7791fbeab15f6d0fc7.tar.bz2 |
Issue #15478: Use source filename in OSError, not destination filename
And other fixes for Windows:
* rename, replace and link require arguments of the same type on Windows
* readlink only supports unicode filenames on Windows
* os.open() specifies the filename on OSError
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 59f4ca8..8cedb9e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3054,7 +3054,7 @@ posix_link(PyObject *self, PyObject *args, PyObject *kwargs) Py_END_ALLOW_THREADS if (!result) { - return_value = path_error(&dst); + return_value = path_error(&src); goto exit; } #else @@ -3234,7 +3234,6 @@ posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) if (error == ERROR_FILE_NOT_FOUND) goto exit; Py_DECREF(list); - path.func = "FindFirstFile"; list = path_error(&path); goto exit; } @@ -3263,7 +3262,6 @@ posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) it got to the end of the directory. */ if (!result && GetLastError() != ERROR_NO_MORE_FILES) { Py_DECREF(list); - path.func = "FindNextFile"; list = path_error(&path); goto exit; } @@ -3782,7 +3780,7 @@ internal_rename(PyObject *args, PyObject *kwargs, int is_replace) Py_END_ALLOW_THREADS if (!result) { - return_value = path_error(&dst); + return_value = path_error(&src); goto exit; } @@ -6707,7 +6705,7 @@ posix_symlink(PyObject *self, PyObject *args, PyObject *kwargs) Py_END_ALLOW_THREADS if (result) { - return_value = path_error(&dst); + return_value = path_error(&src); goto exit; } #endif @@ -7059,12 +7057,6 @@ posix_open(PyObject *self, PyObject *args, PyObject *kwargs) Py_END_ALLOW_THREADS if (fd == -1) { -#ifdef MS_WINDOWS - /* force use of posix_error here for exact backwards compatibility */ - if (path.wide) - return_value = posix_error(); - else -#endif return_value = path_error(&path); goto exit; } |