diff Include/fileobject.h @ 51535:dbdd94cd07fb legacy-trunk

Issue #5204: Define _PyVerify_fd on VC6 to make test_fdopen (test_os.py) pass.
author Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
date Wed, 11 Feb 2009 04:13:06 +0000
parents 0415417cfd48
children 7c933683010d
line wrap: on
line diff
--- a/Include/fileobject.h	Wed Feb 11 00:06:17 2009 +0000
+++ b/Include/fileobject.h	Wed Feb 11 04:13:06 2009 +0000
@@ -75,6 +75,9 @@
  * 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