]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-144652: Support Windows exit status in support get_signal_name() (GH-144653...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Feb 2026 11:42:26 +0000 (12:42 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Feb 2026 11:42:26 +0000 (11:42 +0000)
gh-144652: Support Windows exit status in support get_signal_name() (GH-144653)

Format Windows exit status as hexadecimal.
(cherry picked from commit b121dc434748772272514311fe315e009fdfe6e5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/support/__init__.py
Lib/test/test_support.py

index 2d14cade188698464deace4957149f9ba05b6059..6635ec3474e12ec6a2f684a1a93b6ec08df49a37 100644 (file)
@@ -3034,6 +3034,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 27cd5afb390ec3d1e783935ad29ad77924e884c2..79f0e2eb29ff4cac45a4fc29a5aec0eb8f8686e8 100644 (file)
@@ -778,6 +778,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)