Patch #1350409: Port signal handling to VS 2005.

This commit is contained in:
Martin v. Löwis 2005-11-28 17:34:23 +00:00
parent 3a9a3e7864
commit b45b315855
3 changed files with 20 additions and 0 deletions

View File

@ -113,6 +113,7 @@ David Chaum
Nicolas Chauvat Nicolas Chauvat
Michael Chermside Michael Chermside
Albert Chin-A-Young Albert Chin-A-Young
Adal Chiriliuc
Tom Christiansen Tom Christiansen
Vadim Chugunov Vadim Chugunov
David Cinege David Cinege

View File

@ -12,6 +12,8 @@ What's New in Python 2.5 alpha 1?
Core and builtins Core and builtins
----------------- -----------------
- Patch #1350409: Work around signal handling bug in Visual Studio 2005.
- Bug #1281408: Py_BuildValue now works correct even with unsigned longs - Bug #1281408: Py_BuildValue now works correct even with unsigned longs
and long longs. and long longs.

View File

@ -1615,6 +1615,23 @@ PyOS_getsig(int sig)
return context.sa_handler; return context.sa_handler;
#else #else
PyOS_sighandler_t handler; 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); handler = signal(sig, SIG_IGN);
if (handler != SIG_ERR) if (handler != SIG_ERR)
signal(sig, handler); signal(sig, handler);