]> granicus.if.org Git - python/commitdiff
Issue #5204: Define _PyVerify_fd on VC6 to make
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Wed, 11 Feb 2009 04:13:06 +0000 (04:13 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Wed, 11 Feb 2009 04:13:06 +0000 (04:13 +0000)
test_fdopen (test_os.py) pass.

Include/fileobject.h

index 1fed47b895730086292365bc524ada14f8d295a2..77903be48eee1a58e412d6cd52a2ba6a1ea95a27 100644 (file)
@@ -75,6 +75,9 @@ int _PyFile_SanitizeMode(char *mode);
  * 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