summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2006-07-03 14:59:05 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2006-07-03 14:59:05 (GMT)
commit74c3ea0a0f6599da7dd9a502b5a66aeb9512d8c3 (patch)
tree910adede1919c53bd243bbdf5fb2a62c5478fa0a
parent2eda1b78f9b3d03260445dc1bdbae477cb3e5885 (diff)
downloadcpython-74c3ea0a0f6599da7dd9a502b5a66aeb9512d8c3.zip
cpython-74c3ea0a0f6599da7dd9a502b5a66aeb9512d8c3.tar.gz
cpython-74c3ea0a0f6599da7dd9a502b5a66aeb9512d8c3.tar.bz2
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.
-rw-r--r--Modules/timemodule.c2
-rw-r--r--Objects/exceptions.c6
-rw-r--r--Objects/fileobject.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 2133273..402e349 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -467,7 +467,7 @@ time_strftime(PyObject *self, PyObject *args)
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");
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 38d7350..be9627c 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -1967,7 +1967,7 @@ static PyMethodDef functions[] = {
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 @@ _PyExc_Init(void)
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 @@ _PyExc_Fini(void)
{
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);
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 050146a..76b7da6 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -241,7 +241,7 @@ open_the_file(PyFileObject *f, char *name, char *mode)
}
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