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

aio-libs / multidict / 33994420898
87%

Build:
DEFAULT BRANCH: master
Ran 05 Sep 2026 09:56PM 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

05 Sep 2026 09:55PM UTC coverage: 85.377% (+0.03%) from 85.345%
33994420898

push

github

web-flow
Fix segfault in `add()` with a keyword-only required argument (#1376)

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

## What do these changes do?

`MultiDict().add(key="k")` — a required argument supplied only by
keyword, with the other missing —
segfaulted the interpreter instead of raising `TypeError`. The
two-argument FASTCALL parser `parse2()`
(`_multilib/parser.h`) did not enforce `minargs` in its keyword branch,
so `value` reached the caller as
a NULL pointer that was then dereferenced. Calls with more than two
keyword arguments were also
mis-routed into the one-keyword path.

`parse2()` now enforces `minargs` when the only supplied argument comes
by keyword, and rejects
more-than-two keyword arguments. The pure-Python backend already raised
the correct `TypeError`s for
these calls, so this only brings the C extension in line — no
pure-Python change is needed.

## Are there changes in behavior for the user?

Yes: `MultiDict().add(key="k")` and `add(key="k", value="v", extra="e")`
now raise `TypeError` (the same
messages the pure-Python implementation raises) instead of crashing /
silently misbehaving.

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

No. A localized fix in one argument-parser function, plus a parametrized
regression test.

## Related issue number

Same argument-parser family as the `setdefault()` segfault #1159 (fixed
narrowly by #1160); `add()` was
still affected. Surfaced by the C-extension analysis report #1306.

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
(`test_add_missing_required_argument`, both backends)
- [x] Documentation reflects the changes (no public API change)
- [ ] N/A — no `CONTRIBUTORS.txt` in this repo
- [x] Add a new news fragment into the `CHANGES/` folder

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>

627 of 1254 branches covered (50.0%)

Branch coverage included in aggregate %.

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

4079 of 4258 relevant lines covered (95.8%)

1.92 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 33994420898.1 05 Sep 2026 09:56PM UTC 62
85.38
GitHub Action Run
Source Files on build 33994420898
  • Tree
  • List 31
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33994420898
  • 1c227ee9 on github
  • Prev Build on master (#33992903551)
  • Next Build on master (#33996039876)
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