]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-144652: Support Windows exit status in support get_signal_name() (#144653)
authorVictor Stinner <vstinner@python.org>
Tue, 10 Feb 2026 11:15:14 +0000 (12:15 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Feb 2026 11:15:14 +0000 (12:15 +0100)
Format Windows exit status as hexadecimal.

Lib/test/support/__init__.py
Lib/test/test_support.py

index 66469d088f339cf4d3c911f9359c5e57ee7d89be..307bac65ae50a85e2d618ff4efadb836c9f6b6d3 100644 (file)
@@ -3116,6 +3116,10 @@ def get_signal_name(exitcode):
     except KeyError:
         pass
 
+    # Format Windows exit status as hexadecimal
+    if 0xC0000000 <= exitcode:
+        return f"0x{exitcode:X}"
+
     return None
 
 class BrokenIter:
index be7e307b4f11112c0b406287be22d0a5066fca00..a3129dbcb0a54e00bac3f3114c5f688b2fed2f5e 100644 (file)
@@ -788,6 +788,7 @@ class TestSupport(unittest.TestCase):
             (128 + int(signal.SIGABRT), 'SIGABRT'),
             (3221225477, "STATUS_ACCESS_VIOLATION"),
             (0xC00000FD, "STATUS_STACK_OVERFLOW"),
+            (0xC0000906, "0xC0000906"),
         ):
             self.assertEqual(support.get_signal_name(exitcode), expected,
                              exitcode)