summaryrefslogtreecommitdiff
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2006-06-12 15:45:12 +0000
committerKristján Valur Jónsson <kristjan@ccpgames.com>2006-06-12 15:45:12 +0000
commit4f1670cc700bdd93ea018d3b831ab99c3790b81c (patch)
treee0ee80cec65f451efdf6a8b267beb3d5157798b5 /Modules/timemodule.c
parentcc611d42bb63e33fcd864a63aa35bfc16e951a06 (diff)
downloadcpython-4f1670cc700bdd93ea018d3b831ab99c3790b81c.tar.gz
Fix the CRT argument error handling for VisualStudio .NET 2005. Install a CRT error handler and disable the assertion for debug builds. This causes CRT to set errno to EINVAL.
This update fixes crash cases in the test suite where the default CRT error handler would cause process exit.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 23de173962..2133273872 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -467,6 +467,14 @@ time_strftime(PyObject *self, PyObject *args)
return ret;
}
free(outbuf);
+#if defined _MSC_VER && _MSC_VER >= 1400
+ /* VisualStudio .NET 2005 does this properly */
+ if (buflen == 0 && errno == EINVAL) {
+ PyErr_SetString(PyExc_ValueError, "Invalid format string");
+ return 0;
+ }
+#endif
+
}
}