diff options
Diffstat (limited to 'Include/fileobject.h')
-rw-r--r-- | Include/fileobject.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Include/fileobject.h b/Include/fileobject.h index c2334b21c0..ba506ec0b3 100644 --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -70,6 +70,20 @@ size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); */ int _PyFile_SanitizeMode(char *mode); +#if defined _MSC_VER && _MSC_VER >= 1400 +/* A routine to check if a file descriptor is valid on Windows. Returns 0 + * and sets errno to EBADF if it isn't. This is to avoid Assertions + * from various functions in the Windows CRT beginning with + * Visual Studio 2005 + */ +int _PyVerify_fd(int fd); +#elif defined _MSC_VER && _MSC_VER >= 1200 +/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */ +#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0) +#else +#define _PyVerify_fd(A) (1) /* dummy */ +#endif + #ifdef __cplusplus } #endif |