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

aio-libs / multidict / 35971554192
86%

Build:
DEFAULT BRANCH: master
Ran 24 Sep 2026 07:48AM 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

24 Sep 2026 07:47AM UTC coverage: 87.533% (+0.04%) from 87.497%
35971554192

push

github

web-flow
Pool the view and iterator shells (#1541)

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

## What do these changes do?

Every `.items()`, `.keys()`, `.values()` and `iter()` allocated a GC
object and dropped it again a moment later. Those shells now come from
two more module-state pools, one for the three view types and one for
the three iterator types: within a family the types differ only in their
methods, so one shell fits any of them, which is the only thing that
makes sharing a pool safe.

A pooled shell keeps the GC preheader it was allocated with, which
`PyObject_GC_UnTrack()` leaves in the untracked state, so reuse only has
to redo what `PyObject_GC_New()` does to the object header. That is left
to `PyObject_Init()` rather than written out, so a debug interpreter's
refcount totals stay right. An interpreter built `--with-trace-refs`
turns the pools off instead, for the reason it cannot have freelists at
all: a shell is reused without ever being freed, so it is never taken
off the all-objects list that reusing it would put it back on.

The pool is reached through the view's multidict, so a shell the GC has
already cleared is freed rather than pooled.

## Are there changes in behavior for the user?

No. Views and iterators are cheaper to make, nothing observable
otherwise.

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

No. It is two more pools of the kind #1539 introduced, and the
`tp_free` path is still there for every shell a pool declines.

## Related issue number

None.

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes
- [x] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt` — N/A, no such file in this repo
- [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`

---

Third of five, stacked on #1539 and #1540 and i... (continued)

767 of 1534 branches covered (50.0%)

Branch coverage included in aggregate %.

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

7413 of 7811 relevant lines covered (94.9%)

1.9 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 35971554192.1 24 Sep 2026 07:48AM UTC 86
87.53
GitHub Action Run
Source Files on build 35971554192
  • 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 #35971554192
  • 51c75e40 on github
  • Prev Build on master (#35971413209)
  • Next Build on master (#35971910018)
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