8000 gh-127572: Fix `test_structmembers` initialization (GH-127577) · python/cpython@6fc6436 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6fc6436

Browse files
authored
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).
1 parent 7f882c8 commit 6fc6436

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Lib/test/test_capi/test_structmembers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _make_test_object(cls):
3939
"hi", # T_STRING_INPLACE
4040
12, # T_LONGLONG
4141
13, # T_ULONGLONG
42-
"c", # T_CHAR
42+
b"c", # T_CHAR
4343
)
4444

4545

Modules/_testcapi/structmember.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
6060
"T_FLOAT", "T_DOUBLE", "T_STRING_INPLACE",
6161
"T_LONGLONG", "T_ULONGLONG", "T_CHAR",
6262
NULL};
63-
static const char fmt[] = "|bbBhHiIlknfds#LKC";
63+
static const char fmt[] = "|bbBhHiIlknfds#LKc";
6464
test_structmembers *ob;
6565
const char *s = NULL;
6666
Py_ssize_t string_len = 0;

0 commit comments

Comments
 (0)
0