• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aio-libs / multidict / 34814557513
87%

Build:
DEFAULT BRANCH: master
Ran 14 Sep 2026 06:42AM UTC
Jobs 1
Files 34
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Sep 2026 06:41AM UTC coverage: 86.024% (+0.04%) from 85.981%
34814557513

push

github

web-flow
Make hash table index slots atomic under free-threading (#1454)

<!-- Thank you for your contribution! -->

## What do these changes do?

`htkeys_get_index()`/`htkeys_set_index()` in the C extension's hash
table were plain, non-atomic array accesses. Under free threading,
`popall()`/`popone()`/`__delitem__`/`add()` rewrite a slot in place
while a lock-free `get()`/`getone()`/`__getitem__`/`__contains__` on
another thread walks the same array with no lock at all. ThreadSanitizer
caught this as a genuine data race between `multidict_popall()` and
`multidict_get()`. Both accessors now go through relaxed atomics under
`Py_GIL_DISABLED`, matching the existing
`entry->identity`/`value`/`hash`
protocol already used elsewhere in `hashtable.h`. Relaxed ordering is
sufficient: every value ever stored in an index slot is already a
legitimate index or `DKIX_EMPTY`/`DKIX_DUMMY`, so a non-tearing relaxed
load can only ever observe one of those.

## Are there changes in behavior for the user?

No. This is a free-threaded-build-only internal fix; observable
behavior is unchanged.

## Is it a substantial burden for the maintainers to support this?

No, it mirrors the existing atomic-accessor pattern already used for
other fields in the same file.

## Related issue number

N/A. Found via a ThreadSanitizer run against the free-threaded build,
not filed as a separate issue first.

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt`
- [x] Add a new news fragment into the `CHANGES/` folder
- [x] `make doc-spelling` passes and any new technical words are added
to `docs/spelling_wordlist.txt`

<details>
<summary>Agent run details (optional, for reviewers)</summary>

Tests: `pytest -q` (C extension) and `pytest -q --no-c-extensions` (pure
Python) both pass; confirmed via ThreadSanitizer
(`MULTIDICT_TSAN_BUILD=1 MULT... (continued)

715 of 1430 branches covered (50.0%)

Branch coverage included in aggregate %.

21 of 21 new or added lines in 1 file covered. (100.0%)

5200 of 5446 relevant lines covered (95.48%)

1.91 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 34814557513.1 14 Sep 2026 06:42AM UTC 68
86.02
GitHub Action Run
Source Files on build 34814557513
  • Tree
  • List 34
  • Changed 3
  • Source Changed 1
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #34814557513
  • dd74db1b on github
  • Prev Build on master (#34813154583)
  • Next Build on master (#34826710370)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc