[Python-checkins] r46894 - in python/trunk:Modules/timemodule.c Objects/exceptions.c Objects/fileobject.c

Thomas Heller theller at python.net
Mon Jul 3 16:13:20 CEST 2006


Kristján V. Jónsson schrieb:
> Thomas, can you check if testing for the macro __STDC_SECURE_LIB__ in addition to testing the _MSC_VER resolves the problem?  I see no versioning macros for the CRT that we can use for this. 

Yes, this attached patch works for me.

Thomas
Index: exceptions.c
===================================================================
--- exceptions.c	(revision 47207)
+++ exceptions.c	(working copy)
@@ -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);



More information about the Python-checkins mailing list