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

aio-libs / multidict / 35901661255
87%

Build:
DEFAULT BRANCH: master
Ran 23 Sep 2026 06:20PM UTC
Jobs 1
Files 42
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

23 Sep 2026 06:19PM UTC coverage: 87.403% (-0.03%) from 87.432%
35901661255

push

github

web-flow
Drop two module state lookups that were already answered (#1536)

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

## What do these changes do?

Two places in the C extension asked for the module state although it was
already at hand.

`MultiDict.__init__()` and `CIMultiDict.__init__()` called
`get_mod_state_by_def()`, which is `PyType_GetModuleByDef()` plus
`PyModule_GetState()`, even though `tp_new()` stores that same pointer
in
`self->state` before either of them can run. They read the field now.
The
two proxy `tp_init()`s are left alone: `MultiDictProxy`'s `tp_new` is
`PyType_GenericNew`, so `self->md` is still `NULL` there and the lookup
is
the only way to get the state.

The `istr` object had a `mod_state *` field that was written on every
creation and never read; the only field ever read off an `istr` is
`canonical`. Dropping it also takes eight bytes off every `istr`.

This is C-extension-only. The pure-Python backend has no module state,
so
there is nothing to mirror there.

## Are there changes in behavior for the user?

No.

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

No, it removes code.

## Related issue number

N/A

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes <!-- N/A, no user-visible API
change -->
- [ ] 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`

Drafted with Claude Opus 5 via Claude Code; reviewed by @asvetlov.

<details>
<summary>Agent run details (optional, for reviewers)</summary>

Measured with callgrind, instructions retired per operation,
`PYTHONHASHSEED=0`,
GC collected then disabled, each case run at N and 2N iterations with
the totals
subtracted so startup and loop overhead cancel. CPython 3.14.7, GIL
build.

| benchma... (continued)

765 of 1530 branches covered (50.0%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 1 file covered. (0.0%)

7221 of 7607 relevant lines covered (94.93%)

1.9 hits per line

Uncovered Changes

Lines Coverage ∆ File
3
93.1
-0.13% tests/test_multidict.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 35901661255.1 23 Sep 2026 06:20PM UTC 84
87.4
GitHub Action Run
Source Files on build 35901661255
  • Tree
  • List 42
  • 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 #35901661255
  • 88026da8 on github
  • Prev Build on master (#35901354185)
  • Next Build on master (#35903992859)
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