Commit 21f93aa3 authored by Hirokazu Yamamoto's avatar Hirokazu Yamamoto

Should use posix_error here.

parent 89213cb7
......@@ -248,7 +248,7 @@ class TestNtpath(unittest.TestCase):
self.assertFalse(ntpath.sameopenfile(tf1.fileno(), tf2.fileno()))
# Make sure invalid values don't cause issues on win32
if sys.platform == "win32":
with self.assertRaises(ValueError):
with self.assertRaises(OSError):
# Invalid file descriptors shouldn't display assert
# dialogs (#4804)
ntpath.sameopenfile(-1, -1)
......
......@@ -2803,14 +2803,12 @@ posix__getfileinformation(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:_getfileinformation", &fd))
return NULL;
if (!_PyVerify_fd(fd)) {
PyErr_SetString(PyExc_ValueError, "received invalid file descriptor");
return NULL;
}
if (!_PyVerify_fd(fd))
return posix_error();
hFile = (HANDLE)_get_osfhandle(fd);
if (hFile == INVALID_HANDLE_VALUE)
return win32_error("_getfileinformation", NULL);
return posix_error();
if (!GetFileInformationByHandle(hFile, &info))
return win32_error("_getfileinformation", NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment