File tree Expand file tree Collapse file tree 2 files changed +8
-24
lines changed
Expand file tree Collapse file tree 2 files changed +8
-24
lines changed Original file line number Diff line number Diff line change @@ -2022,29 +2022,12 @@ def NumRunning(self):
20222022NO_ARG = - 20
20232023
20242024
2025- _SIGNAL_MESSAGES = {
2026- SIGSEGV : 'Segmentation fault' ,
2027- SIGABRT : 'Aborted' ,
2028- SIGILL : 'Illegal instruction' ,
2029- SIGFPE : 'Floating point exception' ,
2030- SIGBUS : 'Bus error' ,
2031- SIGQUIT : 'Quit' ,
2032- SIGTERM : 'Terminated' ,
2033- SIGKILL : 'Killed' ,
2034- }
2035-
2036-
20372025def GetSignalMessage (sig_num ):
20382026 # type: (int) -> Optional[str]
2039- """Get signal message from libc or fallback to hard-coded."""
2040- msg = None # type: Optional[str]
2041-
2027+ """Get signal message from libc."""
20422028 if mylib .PYTHON :
2043- msg = libc .strsignal (sig_num )
2044- if msg is not None :
2045- return msg
2046-
2047- return _SIGNAL_MESSAGES .get (sig_num )
2029+ return libc .strsignal (sig_num )
2030+ return None
20482031
20492032
20502033class Waiter (object ):
Original file line number Diff line number Diff line change 1212"""
1313import unittest
1414import sys
15+ import signal
1516
1617import libc # module under test
1718
@@ -368,10 +369,10 @@ def testSleepUntilError(self):
368369 # Not testing errno case
369370
370371 def testStrsignal (self ):
371- self .assertEqual ('Segmentation fault' , libc .strsignal (11 ))
372- self .assertEqual ('Aborted' , libc .strsignal (6 ))
373- self .assertEqual ('Illegal instruction' , libc .strsignal (4 ))
374- self .assertEqual ('Terminated' , libc .strsignal (15 ))
372+ self .assertEqual ('Segmentation fault' , libc .strsignal (signal . SIGSEGV ))
373+ self .assertEqual ('Aborted' , libc .strsignal (signal . SIGABRT ))
374+ self .assertEqual ('Illegal instruction' , libc .strsignal (signal . SIGILL ))
375+ self .assertEqual ('Terminated' , libc .strsignal (signal . SIGTERM ))
375376
376377 with self .assertRaises (ValueError ):
377378 libc .strsignal (999 )
You can’t perform that action at this time.
0 commit comments