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

aio-libs / multidict / 34397817863
87%

Build:
DEFAULT BRANCH: master
Ran 09 Sep 2026 07:55PM UTC
Jobs 1
Files 31
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

09 Sep 2026 07:54PM UTC coverage: 85.141% (+0.04%) from 85.099%
34397817863

push

github

web-flow
Protect MultiDict repr() with a critical section and fix recursion guards (#1431)

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

## What do these changes do?

Protects `repr()` of `MultiDict`, `MultiDictProxy`, and their
items/keys/values
views in the C extension with `Py_BEGIN_CRITICAL_SECTION`, avoiding data
races
when another thread mutates the multidict during iteration on the
free-threaded build of CPython. Also adds the missing `Py_ReprEnter`/
`Py_ReprLeave` recursion guard to `MultiDictProxy` and `KeysView` repr
in the
C extension (already present on `MultiDict`, `ItemsView`, and
`ValuesView`),
consolidates that guard plus the `__name__` lookup into the shared
`md_repr()` helper, and adds the same missing guard to the pure-Python
`_KeysView.__repr__`, which never had it either.

## Are there changes in behavior for the user?

Yes: a self-referential `MultiDictProxy` or `KeysView` now prints `...`
for
the cyclic reference instead of recursing until `RecursionError`,
matching
the existing behavior of `MultiDict`, `ItemsView`, and `ValuesView`, on
both
the C extension and the pure-Python implementation.

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

No, it only touches the `repr()` implementations and uses the critical
section macros already vendored via `pythoncapi_compat.h`.

## Related issue number

#1432 

## 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` (1808 passed, C extension + pure-Python legs) and
`MULTIDICT_NO_EXTENSIONS=1 pytest -q --no-c-extensions` (917 passed,
pure-Python-only leg)
Lint: `make lint` (r... (continued)

634 of 1268 branches covered (50.0%)

Branch coverage included in aggregate %.

16 of 16 new or added lines in 2 files covered. (100.0%)

4242 of 4459 relevant lines covered (95.13%)

1.9 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 34397817863.1 09 Sep 2026 07:55PM UTC 62
85.15
GitHub Action Run
Source Files on build 34397817863
  • Tree
  • List 31
  • Changed 3
  • Source Changed 2
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #34397817863
  • e65b0f28 on github
  • Prev Build on master (#34363670759)
  • Next Build on master (#34468450272)
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