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

aio-libs / multidict / 36119059551
87%

Build:
DEFAULT BRANCH: master
Ran 25 Sep 2026 09:33AM UTC
Jobs 1
Files 43
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

25 Sep 2026 09:32AM UTC coverage: 87.066% (-0.08%) from 87.146%
36119059551

push

github

web-flow
Raise the watcher limit from 8 to 32 (#1574)

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

## What do these changes do?

Raises `MULTIDICT_MAX_WATCHERS` from 8 to 32. The occupancy mask becomes
a `uint32_t`.

Two changes keep the higher limit from costing anything:

- Delivery walks only the set bits of the mask, using ctz. Previously it
scanned every slot and copied the whole `user_data` array once per
event, which would have made each event cost more at 32 slots.
- The per-multidict record sizes `user_data` to one past the highest
watcher ID that multidict was watched through, and grows with
`PyMem_Realloc` when needed. Every access to `md->watch` happens under
the multidict's critical section or in dealloc, so moving the record is
safe. `md_watch_detach` now ignores an ID beyond the record.

C extension only; the watchers API has no pure-Python counterpart.

## Are there changes in behavior for the user?

Up to 32 watchers can be registered at a time instead of 8. Watchers are
not in a release yet, so nothing shipped changes.

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

No. The change stays inside `watch.h`, plus the constant and the docs.

## Related issue number

Follow-up to #1551.

## 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` (N/A, no such file in this repo)
- [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>

Callgrind instruction counts on CPython 3.14.7 (GIL). The free-threaded
build shows the same pattern.

| | master (8, fixed) | 32, fixed array | this PR (32, sized record) |
|---|---|---|---|
| one event, watcher in slot 0 | 7599 | 7738 | 7537 |
| one event, watcher in th... (continued)

779 of 1558 branches covered (50.0%)

Branch coverage included in aggregate %.

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

1 existing line in 1 file now uncovered.

7979 of 8501 relevant lines covered (93.86%)

1.88 hits per line

Uncovered Changes

Lines Coverage ∆ File
10
74.57
-0.65% tests/test_capi.py

Coverage Regressions

Lines Coverage ∆ File
1
74.57
-0.65% tests/test_capi.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36119059551.1 25 Sep 2026 09:33AM UTC 86
87.07
GitHub Action Run
Source Files on build 36119059551
  • Tree
  • List 43
  • 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 #36119059551
  • e52b43cb on github
  • Prev Build on master (#36115378344)
  • Next Build on master (#36123678037)
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