https://github.com/python/cpython/commit/6fc643674983e27ec5cc312f2e83468050d1d364
commit: 6fc643674983e27ec5cc312f2e83468050d1d364
branch: main
author: Sam Gross <[email protected]>
committer: encukou <[email protected]>
date: 2024-12-04T09:58:22+01:00
summary:
gh-127572: Fix `test_structmembers` initialization (GH-127577)
gh-127572: Fix `test_structmembers` initialization.
The 'C' format code expects an `int` as a destination (not a `char`).
This led to test failures on big-endian platforms like s390x. Use the
'c' format code, which expects a `char` as the destination (but requires
a Python byte objects instead of a str).
files:
M Lib/test/test_capi/test_structmembers.py
M Modules/_testcapi/structmember.c
diff --git a/Lib/test/test_capi/test_structmembers.py
b/Lib/test/test_capi/test_structmembers.py
index ae9168fc39243f..f14ad9a9a5f512 100644
--- a/Lib/test/test_capi/test_structmembers.py
+++ b/Lib/test/test_capi/test_structmembers.py
@@ -39,7 +39,7 @@ def _make_test_object(cls):
"hi", # T_STRING_INPLACE
12, # T_LONGLONG
13, # T_ULONGLONG
- "c", # T_CHAR
+ b"c", # T_CHAR
)
diff --git a/Modules/_testcapi/structmember.c b/Modules/_testcapi/structmember.c
index c1861db18c4af2..ef30a5a9944e3c 100644
--- a/Modules/_testcapi/structmember.c
+++ b/Modules/_testcapi/structmember.c
@@ -60,7 +60,7 @@ test_structmembers_new(PyTypeObject *type, PyObject *args,
PyObject *kwargs)
"T_FLOAT", "T_DOUBLE", "T_STRING_INPLACE",
"T_LONGLONG", "T_ULONGLONG", "T_CHAR",
NULL};
- static const char fmt[] = "|bbBhHiIlknfds#LKC";
+ static const char fmt[] = "|bbBhHiIlknfds#LKc";
test_structmembers *ob;
const char *s = NULL;
Py_ssize_t string_len = 0;
_______________________________________________
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]