summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-11-28 17:34:23 +0000
committerMartin v. Löwis <martin@v.loewis.de>2005-11-28 17:34:23 +0000
commitd2fb1db2f6934e47423f7968e91302f80d4c7ab3 (patch)
tree4d1ace3a4ec171948b8d5a83da63d9b81ec93c87 /Python
parent36b98a46a20f17cdc0a5da45559bce16362f1775 (diff)
downloadcpython-d2fb1db2f6934e47423f7968e91302f80d4c7ab3.tar.gz
Patch #1350409: Port signal handling to VS 2005.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index ad837d28f6..0b14f8bfbc 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1615,6 +1615,23 @@ PyOS_getsig(int sig)
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);