https://github.com/python/cpython/commit/a000129df30819c3b762592d7586de4d2536f92b
commit: a000129df30819c3b762592d7586de4d2536f92b
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-26T01:02:29+02:00
summary:

gh-158001: Fix test_ctypes.test_version_var() on s390x (#158193)

Py_Version type is "unsigned long", not "int". The bug is visible on
big endian machines such as s390x.

files:
M Lib/test/test_ctypes/test_values.py

diff --git a/Lib/test/test_ctypes/test_values.py 
b/Lib/test/test_ctypes/test_values.py
index 0d62702c0c0fd3..5ce2fdbe77c226 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')

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to