summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-02-10 13:32:24 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-02-10 13:32:24 (GMT)
commit6a743d3694fb5138f5eab393c172c3b6789b0383 (patch)
treebf47b632ad93844f4d50d35df88c38b70ee731f9 /Include
parente71fc8711289a2f748f6dd207d3953622a30abf7 (diff)
downloadcpython-6a743d3694fb5138f5eab393c172c3b6789b0383.zip
cpython-6a743d3694fb5138f5eab393c172c3b6789b0383.tar.gz
cpython-6a743d3694fb5138f5eab393c172c3b6789b0383.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/fileobject.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/fileobject.h b/Include/fileobject.h
index 56cf40a..1fed47b 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -68,6 +68,17 @@ 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);
+#else
+#define _PyVerify_fd(A) (1) /* dummy */
+#endif
+
#ifdef __cplusplus
}
#endif