diff Python/pythonrun.c @ 35961:72555a967d6a legacy-trunk

Patch #1350409: Port signal handling to VS 2005.
author Martin v. Löwis <martin@v.loewis.de>
date Mon, 28 Nov 2005 17:34:23 +0000
parents 1c4d192f1568
children ea083efdc96c
line wrap: on
line diff
--- a/Python/pythonrun.c	Sun Nov 27 20:38:31 2005 +0000
+++ b/Python/pythonrun.c	Mon Nov 28 17:34:23 2005 +0000
@@ -1615,6 +1615,23 @@
 	return context.sa_handler;
 #else
 	PyOS_sighandler_t handler;
+/* Special signal handling for the secure CRT in Visual Studio 2005 */
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+	switch (sig) {
+	/* Only these signals are valid */
+	case SIGINT:
+	case SIGILL:
+	case SIGFPE:
+	case SIGSEGV:
+	case SIGTERM:
+	case SIGBREAK:
+	case SIGABRT:
+		break;
+	/* Don't call signal() with other values or it will assert */
+	default:
+		return SIG_ERR;
+	}
+#endif /* _MSC_VER && _MSC_VER >= 1400 */
 	handler = signal(sig, SIG_IGN);
 	if (handler != SIG_ERR)
 		signal(sig, handler);