Skip to content

Commit e812c4f

Browse files
authored
Fix the C extension build where char is unsigned (#1759)
<!-- Thank you for your contribution! --> ## What do these changes do? The `v7.1.0` tag run failed to build the armv7l wheel, and the other QEMU-emulated wheel jobs were cancelled with it, so nothing was published. On ARM, PowerPC, s390x and RISC-V plain `char` is unsigned, and initializing `empty_htkeys.indices` with `DKIX_EMPTY` (-1) trips `-Wsign-conversion`, fatal under `-Werror` since #1611 turned `-Wconversion` back on. Regular CI never builds those architectures, so it surfaced only on the tag. The fix casts the initializer entries to `char` explicitly. Runtime behaviour was not affected: every read and write of the indices goes through `int8_t*`, so the stored bytes are the same either way. The changelog entry goes straight into the unpublished 7.1.0 section, as RELEASE.md describes for a tag whose run never published anything; the tag gets moved to the merge commit afterwards. ## Are there changes in behavior for the user? No; the C extension builds again where `char` is unsigned. ## Is it a substantial burden for the maintainers to support this? No. ## Related issue number Failed run: https://github.com/aio-libs/multidict/actions/runs/37827427484 ## Checklist - [x] I think the code is well written - [ ] Unit tests for the changes exist N/A, build fix; reproduced and verified with `-funsigned-char` as described below - [x] Documentation reflects the changes - [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt` N/A - [ ] Add a new news fragment into the `CHANGES/` folder N/A, the entry is added to the unreleased 7.1.0 section of `CHANGES.rst` directly - [x] `make doc-spelling` passes and any new technical words are added to `docs/spelling_wordlist.txt` Drafted with Claude Code (Claude Opus 5.5); reviewed by @asvetlov. <details> <summary>Agent run details (optional, for reviewers)</summary> Reproduced on x86_64 by building master with `CFLAGS=-funsigned-char`: the eight `DKIX_EMPTY` initializers were the only errors. With the fix, built with `CFLAGS=-funsigned-char` on CPython 3.10.17, 3.14.7 and 3.14.7t; the full suite passes on all three (4254, 4250 and 4235 passed). `tools/check_inlining.py` passes on 3.14.7 and 3.14.7t. `make doc-spelling` and pre-commit pass. </details>
1 parent f9459a1 commit e812c4f

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎CHANGES.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ identity and hash per entry, which cuts their size by about 45%.
5050
Bug fixes
5151
---------
5252

53+
- Fixed building the C extension on platforms where ``char`` is unsigned,
54+
such as ARM, PowerPC, s390x and RISC-V, which failed on a sign conversion
55+
warning since ``-Wconversion`` took effect -- by :user:`asvetlov`.
56+
57+
*Related issues and pull requests on GitHub:*
58+
:issue:`1759`.
59+
5360
- Fixed :func:`~multidict.getversion` returning only the low 32 bits of
5461
the version on Windows and on 32-bit platforms, where two different
5562
versions could compare equal, and fixed a race in the pure-Python

‎multidict/_multilib/htkeys.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -518,14 +518,14 @@ static const htkeys_t empty_htkeys = {
518518
.num_readers = 0,
519519
.retired_next = NULL,
520520
#endif
521-
.indices = {DKIX_EMPTY,
522-
DKIX_EMPTY,
523-
DKIX_EMPTY,
524-
DKIX_EMPTY,
525-
DKIX_EMPTY,
526-
DKIX_EMPTY,
527-
DKIX_EMPTY,
528-
DKIX_EMPTY},
521+
.indices = {(char)DKIX_EMPTY,
522+
(char)DKIX_EMPTY,
523+
(char)DKIX_EMPTY,
524+
(char)DKIX_EMPTY,
525+
(char)DKIX_EMPTY,
526+
(char)DKIX_EMPTY,
527+
(char)DKIX_EMPTY,
528+
(char)DKIX_EMPTY},
529529
};
530530

531531
/* resume_slots[i] is 0 or 1 + the last slot used by a probe that reached slot

0 commit comments

Comments
 (0)