Skip to content

Commit 8d456ef

Browse files
committed
Pass test_signal on macOS
1 parent c31a6f8 commit 8d456ef

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/core/IronPython.Modules/signal.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,19 @@ public PythonSignalState(PythonContext pc) {
434434
: throw new NotSupportedException("Unsupported platform for signal module");
435435

436436
PySignalToPyHandler = new Dictionary<int, object>(sigs.Length);
437+
object sig_dfl = ScriptingRuntimeHelpers.Int32ToObject(SIG_DFL);
438+
object sig_ign = ScriptingRuntimeHelpers.Int32ToObject(SIG_IGN);
437439
foreach (int sig in sigs) {
438-
PySignalToPyHandler[sig] = SIG_DFL;
440+
PySignalToPyHandler[sig] = sig_dfl;
439441
}
440442
PySignalToPyHandler[SIGINT] = default_int_handler;
441443
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
442-
PySignalToPyHandler[SIGPIPE] = SIG_IGN;
443-
PySignalToPyHandler[SIGXFSZ] = SIG_IGN;
444+
PySignalToPyHandler[SIGPIPE] = sig_ign;
445+
PySignalToPyHandler[SIGXFSZ] = sig_ign;
446+
}
447+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
448+
PySignalToPyHandler.Remove(SIGKILL);
449+
PySignalToPyHandler.Remove(SIGSTOP);
444450
}
445451
}
446452
}

0 commit comments

Comments
 (0)