From 1e9aecc445ae4c8b28b278bffee6c0e1d6d2a7a4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 25 Sep 2026 23:11:38 +0200 Subject: [PATCH] gh-158001: Fix test_ctypes.test_version_var() on s390x Py_Version type is "unsigned long", not "int". The bug is visible on big endian machines such as s390x. --- Lib/test/test_ctypes/test_values.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_ctypes/test_values.py b/Lib/test/test_ctypes/test_values.py index 0d62702c0c0fd35..5ce2fdbe77c2260 100644 --- a/Lib/test/test_ctypes/test_values.py +++ b/Lib/test/test_ctypes/test_values.py @@ -8,7 +8,7 @@ import sys import unittest from ctypes import (Structure, CDLL, POINTER, pythonapi, - c_ubyte, c_char_p, c_int) + c_ubyte, c_char_p, c_int, c_ulong) from test import support from test.support import import_helper, thread_unsafe @@ -77,7 +77,7 @@ def test_version_var(self): # This test accesses the Py_Version integer, which is # exported by the Python dll and should match the sys.hexversion value - version = c_int.in_dll(pythonapi, "Py_Version").value + version = c_ulong.in_dll(pythonapi, "Py_Version").value self.assertEqual(version, sys.hexversion) @thread_unsafe('overrides frozen modules')