[Python-checkins] r47223 - in python/trunk: Modules/timemodule.c Objects/exceptions.c Objects/fileobject.c
kristjan.jonsson
python-checkins at python.org
Mon Jul 3 16:59:05 CEST 2006
Author: kristjan.jonsson
Date: Mon Jul 3 16:59:05 2006
New Revision: 47223
Modified:
python/trunk/Modules/timemodule.c
python/trunk/Objects/exceptions.c
python/trunk/Objects/fileobject.c
Log:
Fix build problems with the platform SDK on windows. It is not sufficient to test for the C compiler version when determining if we have the secure CRT from microsoft. Must test with an undocumented macro, __STDC_SECURE_LIB__ too.
Modified: python/trunk/Modules/timemodule.c
==============================================================================
--- python/trunk/Modules/timemodule.c (original)
+++ python/trunk/Modules/timemodule.c Mon Jul 3 16:59:05 2006
@@ -467,7 +467,7 @@
return ret;
}
free(outbuf);
-#if defined _MSC_VER && _MSC_VER >= 1400
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
/* VisualStudio .NET 2005 does this properly */
if (buflen == 0 && errno == EINVAL) {
PyErr_SetString(PyExc_ValueError, "Invalid format string");
Modified: python/trunk/Objects/exceptions.c
==============================================================================
--- python/trunk/Objects/exceptions.c (original)
+++ python/trunk/Objects/exceptions.c Mon Jul 3 16:59:05 2006
@@ -1967,7 +1967,7 @@
if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \
Py_FatalError("Module dictionary insertion problem.");
-#if defined _MSC_VER && _MSC_VER >= 1400
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
/* crt variable checking in VisualStudio .NET 2005 */
#include <crtdbg.h>
@@ -2120,7 +2120,7 @@
Py_DECREF(bltinmod);
-#if defined _MSC_VER && _MSC_VER >= 1400
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
/* Set CRT argument error handler */
prevCrtHandler = _set_invalid_parameter_handler(InvalidParameterHandler);
/* turn off assertions in debug mode */
@@ -2133,7 +2133,7 @@
{
Py_XDECREF(PyExc_MemoryErrorInst);
PyExc_MemoryErrorInst = NULL;
-#if defined _MSC_VER && _MSC_VER >= 1400
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
/* reset CRT error handling */
_set_invalid_parameter_handler(prevCrtHandler);
_CrtSetReportMode(_CRT_ASSERT, prevCrtReportMode);
Modified: python/trunk/Objects/fileobject.c
==============================================================================
--- python/trunk/Objects/fileobject.c (original)
+++ python/trunk/Objects/fileobject.c Mon Jul 3 16:59:05 2006
@@ -241,7 +241,7 @@
}
if (f->f_fp == NULL) {
-#if defined _MSC_VER && _MSC_VER < 1400
+#if defined _MSC_VER && (_MSC_VER < 1400 || !defined(__STDC_SECURE_LIB__))
/* MSVC 6 (Microsoft) leaves errno at 0 for bad mode strings,
* across all Windows flavors. When it sets EINVAL varies
* across Windows flavors, the exact conditions aren't
More information about the Python-checkins
mailing list