Mailing List Archive

Enhance regrtest get_signal_name(): support shell exit code (#117647)
https://github.com/python/cpython/commit/ed785c08993467461711c56eb5e6f88331062cca
commit: ed785c08993467461711c56eb5e6f88331062cca
branch: main
author: Victor Stinner <vstinner@python.org>
committer: vstinner <vstinner@python.org>
date: 2024-04-08T17:16:43Z
summary:

Enhance regrtest get_signal_name(): support shell exit code (#117647)

files:
M Lib/test/libregrtest/utils.py
M Lib/test/test_regrtest.py

diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 837f73b28b4018..791f996127ea58 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -698,6 +698,14 @@ def get_signal_name(exitcode):
except ValueError:
pass

+ # Shell exit code (ex: WASI build)
+ if 128 < exitcode < 256:
+ signum = exitcode - 128
+ try:
+ return signal.Signals(signum).name
+ except ValueError:
+ pass
+
try:
return WINDOWS_STATUS[exitcode]
except KeyError:
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index d222b3803fdba7..809abd7e92d65f 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -2291,6 +2291,7 @@ def test_get_signal_name(self):
for exitcode, expected in (
(-int(signal.SIGINT), 'SIGINT'),
(-int(signal.SIGSEGV), 'SIGSEGV'),
+ (128 + int(signal.SIGABRT), 'SIGABRT'),
(3221225477, "STATUS_ACCESS_VIOLATION"),
(0xC00000FD, "STATUS_STACK_OVERFLOW"),
):

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-leave@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: list-python-checkins@lists.gossamer-threads.com