Skip to content

Commit b121dc4

Browse files
authored
gh-144652: Support Windows exit status in support get_signal_name() (#144653)
Format Windows exit status as hexadecimal.
1 parent 73fa6be commit b121dc4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Lib/test/support/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,6 +3116,10 @@ def get_signal_name(exitcode):
31163116
except KeyError:
31173117
pass
31183118

3119+
# Format Windows exit status as hexadecimal
3120+
if 0xC0000000 <= exitcode:
3121+
return f"0x{exitcode:X}"
3122+
31193123
return None
31203124

31213125
class BrokenIter:

Lib/test/test_support.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ def test_get_signal_name(self):
788788
(128 + int(signal.SIGABRT), 'SIGABRT'),
789789
(3221225477, "STATUS_ACCESS_VIOLATION"),
790790
(0xC00000FD, "STATUS_STACK_OVERFLOW"),
791+
(0xC0000906, "0xC0000906"),
791792
):
792793
self.assertEqual(support.get_signal_name(exitcode), expected,
793794
exitcode)

0 commit comments

Comments
 (0)