Skip to content

Commit a000129

Browse files
authored
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.
1 parent b71989d commit a000129

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎Lib/test/test_ctypes/test_values.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import unittest
1010
from ctypes import (Structure, CDLL, POINTER, pythonapi,
11-
c_ubyte, c_char_p, c_int)
11+
c_ubyte, c_char_p, c_int, c_ulong)
1212
from test import support
1313
from test.support import import_helper, thread_unsafe
1414

@@ -77,7 +77,7 @@ def test_version_var(self):
7777
# This test accesses the Py_Version integer, which is
7878
# exported by the Python dll and should match the sys.hexversion value
7979

80-
version = c_int.in_dll(pythonapi, "Py_Version").value
80+
version = c_ulong.in_dll(pythonapi, "Py_Version").value
8181
self.assertEqual(version, sys.hexversion)
8282

8383
@thread_unsafe('overrides frozen modules')

0 commit comments

Comments
 (0)