summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2000-08-15 00:46:38 (GMT)
committerMark Hammond <mhammond@skippinet.com.au>2000-08-15 00:46:38 (GMT)
commit33a6da9971a923ceaaee1406d0feaa64b8d1759a (patch)
tree745af43b9b957bc6727f8df7348e9cd2414303bc /Modules
parent557a044f74fffcb54ba65dd179953e8afe7d8485 (diff)
downloadcpython-33a6da9971a923ceaaee1406d0feaa64b8d1759a.zip
cpython-33a6da9971a923ceaaee1406d0feaa64b8d1759a.tar.gz
cpython-33a6da9971a923ceaaee1406d0feaa64b8d1759a.tar.bz2
Fix for bug #110670 - Win32 os.listdir raises confusing errors:
The existing win32_error() function now returns the new(ish) WindowsError, ensuring we get correct error messages.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index e7f35cf..d7755bf 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -349,12 +349,16 @@ posix_error_with_filename(char* name)
static PyObject *
win32_error(char* function, char* filename)
{
- /* XXX this could be improved */
+ /* XXX We should pass the function name along in the future.
+ (_winreg.c also wants to pass the function name.)
+ This would however require an additional param to the
+ Windows error object, which is non-trivial.
+ */
errno = GetLastError();
if (filename)
- return PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
+ return PyErr_SetFromWindowsErrWithFilename(errno, filename);
else
- return PyErr_SetFromErrno(PyExc_OSError);
+ return PyErr_SetFromWindowsErr(errno);
}
#endif