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

aio-libs / multidict / 36569202073
87%

Build:
DEFAULT BRANCH: master
Ran 29 Sep 2026 12:37PM UTC
Jobs 1
Files 48
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

29 Sep 2026 12:36PM UTC coverage: 86.936%. Remained the same
36569202073

push

github

web-flow
Release a disposed table's entries without clearing them (#1639)

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

## What do these changes do?

`_htkeys_dispose()` released each entry with three `Py_CLEAR()` calls,
storing NULL into a table that nothing can reach any more, and reloaded
`keys->nentries` after every decref because the compiler cannot prove a
finalizer leaves it alone. It now uses `Py_XDECREF()` and reads the
count once. Every caller disposes a table that is already unpublished
(`_md_release_keys()` after `store_keys()`, the free-threaded drain
after detaching `md->retired`, `_md_publish_rebuilt()` after zeroing
`nentries`), and no iterator or view keeps an `htkeys_t *`, so a
finalizer cannot observe the stale pointers.

This is the first step towards closing the `copy()`/`clear()` gap to
`dict`; the rest comes with per-table entry layouts later.

Callgrind, net Ir per teardown of a 200-entry table (`str` keys, values
equal to keys), before and after:

| build | MultiDict | CIMultiDict |
| --- | ---: | ---: |
| GIL 3.14.7 | 7,348 to 6,749 (-8.2%) | 7,486 to 6,887 (-8.0%) |
| FT 3.14.7t | 9,150 to 8,555 (-6.5%) | 9,231 to 8,636 (-6.4%) |

Clone is unchanged. The pure-Python backend is unaffected.

## Are there changes in behavior for the user?

No.

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

No.

## Related issue number

N/A

## Checklist

- [x] I think the code is well written
- [ ] Unit tests for the changes exist (N/A: no behaviour change,
covered by the existing suite)
- [x] Documentation reflects the changes (N/A)
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt` (N/A)
- [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` passed on 3.14.7 (3693 passed), 3.14.7t (3681
passed), 3.10.17 C ... (continued)

788 of 1576 branches covered (50.0%)

Branch coverage included in aggregate %.

8961 of 9638 relevant lines covered (92.98%)

1.86 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36569202073.1 29 Sep 2026 12:37PM UTC 96
86.93
GitHub Action Run
Source Files on build 36569202073
  • Tree
  • List 48
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #36569202073
  • f4caff99 on github
  • Prev Build on master (#36554860349)
  • Next Build on master (#36676991660)
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