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

aio-libs / multidict / 33996039876
87%

Build:
DEFAULT BRANCH: master
Ran 05 Sep 2026 10:30PM 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 10:29PM UTC coverage: 85.37% (-0.007%) from 85.377%
33996039876

push

github

web-flow
Forbid direct instantiation of iterator types (#1377)

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

## What do these changes do?

`type(iter(md.keys())).__new__(t)` built an uninitialised iterator whose
internal `md` pointer was NULL;
calling `next()` on it dereferenced NULL and segfaulted. The view types
were given a forbidden `tp_new`
for exactly this reason in #1163; the iterator types share the hole.
This adds the same forbidden
`tp_new` to the items/keys/values iterator specs. This is a
C-extension-only concern (the pure-Python
iterators are ordinary Python objects); no pure-Python change is needed.

## Are there changes in behavior for the user?

Yes: directly constructing an internal iterator type now raises
`TypeError: cannot create '..._keysiter' instances directly` instead of
crashing. Normal iteration is
unaffected.

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

No. It mirrors the existing view-type fix (#1163).

## Related issue number

Direct analog of #1163 (view types); same crash class as #1161. Surfaced
by the analysis report #1306.

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
(`test_iter_direct_instantiation_segfault`)
- [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 %.

9 of 11 new or added lines in 1 file covered. (81.82%)

4088 of 4269 relevant lines covered (95.76%)

1.92 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
91.75
-0.12% tests/test_multidict.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 33996039876.1 05 Sep 2026 10:30PM UTC 62
85.38
GitHub Action Run
Source Files on build 33996039876
  • 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 #33996039876
  • 8f0f7543 on github
  • Prev Build on master (#33994420898)
  • Next Build on master (#33997113399)
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