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

aio-libs / multidict / 36133675941
87%

Build:
DEFAULT BRANCH: master
Ran 25 Sep 2026 12:14PM 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 12:13PM UTC coverage: 87.057% (+0.02%) from 87.042%
36133675941

push

github

web-flow
Hold the values across a reentrant compare in MultiDict.__eq__ (#1580)

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

## What do these changes do?

`md_eq()` cached both entry arrays and passed borrowed values to
`PyObject_RichCompareBool()`. A value's `__eq__` runs on the same
thread, so the critical sections do not stop it from clearing or growing
either dict, which freed the cached table and the values being compared.
The C extension now holds references to both values and reloads the
entry arrays around any compare that can run Python code. Identical
values and exact `str` values skip that and are compared directly, which
makes the common header case faster than before.

The pure-Python implementation is memory safe here and is unchanged;
after a mid-compare mutation the result is unspecified on both backends,
as it is for `dict`.

## Are there changes in behavior for the user?

No, apart from the crash being fixed.

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

No.

## Related issue number

Fixes #1579

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes (N/A, no doc changes needed)
- [ ] 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 (all on this branch):
- ASan GIL 3.14.7 (`MULTIDICT_DEBUG_BUILD=1 MULTIDICT_ASAN_BUILD=1
MULTIDICT_NO_FREELIST=1`, `PYTHONMALLOC=malloc`): 2685 passed. The new
`test_eq_value_mutates_dict` reports heap-use-after-free in `md_eq` on
the base commit.
- 3.14.7t C extension: 2691 passed.
- 3.14.7t pure Python (`--no-c-extensions`): 1282 passed.
- 3.10.17 C extension: 2704 passed.

Callgrind, instructions per `a == b` on 200 entries (`PYTHONHASHSEED=0`,... (continued)

779 of 1558 branches covered (50.0%)

Branch coverage included in aggregate %.

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

8019 of 8548 relevant lines covered (93.81%)

1.88 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36133675941.1 25 Sep 2026 12:14PM UTC 86
87.06
GitHub Action Run
Source Files on build 36133675941
  • 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 #36133675941
  • 3e0105ae on github
  • Prev Build on master (#36130559673)
  • Next Build on master (#36144372153)
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