Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.270 diff -c -r2.270 posixmodule.c *** posixmodule.c 2 Nov 2002 17:42:33 -0000 2.270 --- posixmodule.c 5 Nov 2002 20:34:54 -0000 *************** *** 5048,5053 **** --- 5048,5060 ---- if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize)) return NULL; + #ifdef MS_WIN32 + /* MSVC fdopen() crashes with invalid mode, SF #623464 */ + if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { + PyErr_Format(PyExc_ValueError, "invalid file mode '%s'", mode); + return NULL; + } + #endif Py_BEGIN_ALLOW_THREADS fp = fdopen(fd, mode); Py_END_ALLOW_THREADS