8000 Enhance regrtest get_signal_name(): support shell exit code (#117647) · python/cpython@ed785c0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed785c0

Browse files
authored
Enhance regrtest get_signal_name(): support shell exit code (#117647)
1 parent 775912a commit ed785c0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Lib/test/libregrtest/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 CE4E +698,14 @@ def get_signal_name(exitcode):
698698
except ValueError:
699699
pass
700700

701+
# Shell exit code (ex: WASI build)
702+
if 128 < exitcode < 256:
703+
signum = exitcode - 128
704+
try:
705+
return signal.Signals(signum).name
706+
except ValueError:
707+
pass
708+
701709
try:
702710
return WINDOWS_STATUS[exitcode]
703711
except KeyError:

Lib/test/test_regrtest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,6 +2291,7 @@ def test_get_signal_name(self):
22912291
for exitcode, expected in (
22922292
(-int(signal.SIGINT), 'SIGINT'),
22932293
(-int(signal.SIGSEGV), 'SIGSEGV'),
2294+
(128 + int(signal.SIGABRT), 'SIGABRT'),
22942295
(3221225477, "STATUS_ACCESS_VIOLATION"),
22952296
(0xC00000FD, "STATUS_STACK_OVERFLOW"),
22962297
):

0 commit comments

Comments
 (0)
0