mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue 4804. Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions.
This commit is contained in:
parent
e71fc87112
commit
6a743d3694
4 changed files with 137 additions and 36 deletions
|
@ -127,7 +127,7 @@ check_fd(int fd)
|
|||
{
|
||||
#if defined(HAVE_FSTAT)
|
||||
struct stat buf;
|
||||
if (fstat(fd, &buf) < 0 && errno == EBADF) {
|
||||
if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) {
|
||||
PyObject *exc;
|
||||
char *msg = strerror(EBADF);
|
||||
exc = PyObject_CallFunction(PyExc_OSError, "(is)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue