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

aio-libs / multidict / 36405149254
87%

Build:
DEFAULT BRANCH: master
Ran 28 Sep 2026 09:43AM UTC
Jobs 1
Files 45
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

28 Sep 2026 09:41AM UTC coverage: 86.993% (-0.05%) from 87.039%
36405149254

push

github

web-flow
Keep the instance's case mode when re-initializing (#1622)

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

## What do these changes do?

In the C extension, `__init__()` took the case mode from the class whose
`__init__` slot was called, not from the instance. So
`MultiDict.__init__(ci_md, pairs)` quietly turned a `CIMultiDict`
case-sensitive (`type(d)` still `CIMultiDict`, but `"key" in d` became
false for `"Key"`), and `CIMultiDict.__init__(md)` raised `TypeError`.
The pure-Python implementation reads `self._ci` and has neither problem.

`_multidict_tp_init()` now reads `self->is_ci`. Without the parameter
the `MultiDict` and `CIMultiDict` `tp_init` slots were identical, so
`CIMultiDict` inherits `MultiDict`'s, which matches pure Python, where
`CIMultiDict.__init__ is MultiDict.__init__`.

This came up while investigating the TSan report fixed in #1621. It is
also the only way a live multidict's `is_ci` could change, which #1621's
guarded store in `_md_install_keys()` otherwise relies on never
happening.

## Are there changes in behavior for the user?

Yes. Calling one class's `__init__()` on an instance of the other now
keeps the instance's own case mode, and `CIMultiDict.__init__()` accepts
a `MultiDict`, as the pure-Python implementation already did.

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

No. It removes a function.

## Related issue number

Found while working on #1621, and stacked on it: this branch includes
#1621's commit until that one merges. Without #1621, reading
`self->is_ci` here races the unconditional store to `is_ci` that #1621
removes, and CI's TSan job reports it from `test_reinit_thread_safety`.

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes (N/A, the documented behaviour
did not change)
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt` (N/A)
- [x] Add a new news fragment into the `CHANGES/... (continued)

784 of 1568 branches covered (50.0%)

Branch coverage included in aggregate %.

2 of 8 new or added lines in 1 file covered. (25.0%)

8613 of 9234 relevant lines covered (93.27%)

1.87 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
95.2
-0.68% tests/test_mutable_multidict.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36405149254.1 28 Sep 2026 09:43AM UTC 90
86.99
GitHub Action Run
Source Files on build 36405149254
  • Tree
  • List 45
  • 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 #36405149254
  • 9802f1bb on github
  • Prev Build on master (#36402130758)
  • Next Build on master (#36409791975)
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