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

aio-libs / multidict / 35776927198
87%

Build:
DEFAULT BRANCH: master
Ran 22 Sep 2026 07:56PM UTC
Jobs 1
Files 40
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

22 Sep 2026 07:55PM UTC coverage: 87.779% (+0.001%) from 87.778%
35776927198

push

github

web-flow
Do not swallow errors raised while sizing an update argument (#1517)

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

## What do these changes do?

`_multidict_extend_parse_args()` cleared every pending exception when
`PyObject_LengthHint()` failed on the positional argument, so a
`MemoryError` or `KeyboardInterrupt` raised by that object's `__len__`
was discarded and the update simply went ahead with no size estimate.
The fallback is now guarded with `PyErr_ExceptionMatches()`, so only the
`TypeError` from an unusable `__length_hint__` is ignored. That is the
same pattern the sibling probes picked up in #1382.

`PyObject_LengthHint()` already absorbs a missing `__len__` or
`__length_hint__` internally, so the only `TypeError` that reaches this
branch is "`__length_hint__` must be an integer"; a broken hint costs
the preallocation estimate and nothing else, so it stays ignored.

C-extension only. The pure-Python backend reaches `__len__` through a
plain truth test and already propagates, so this closes a divergence
rather than creating one. Plain `MultiDict(arg)` is unaffected on either
backend: its vectorcall path never probes the argument's length, so only
`extend()`, `update()`, `merge()` and subclass construction ever reached
the cleared branch.

## Are there changes in behavior for the user?

Yes, in an edge case. `extend()`, `update()`, `merge()` and subclass
construction now propagate a `MemoryError` or `KeyboardInterrupt` raised
by the argument's `__len__` instead of swallowing it. Arguments without
a
usable length, the common case for a generator, are unchanged.

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

No. It applies the module's existing guard pattern to the one site that
still missed it.

## Related issue number

Findings from the C-extension analysis report #1306. This was the last
open item from that report; everything else in it is already fixed on
master, so #1306 can probably be closed once this lands.

## Checkl... (continued)

765 of 1530 branches covered (50.0%)

Branch coverage included in aggregate %.

22 of 25 new or added lines in 1 file covered. (88.0%)

6791 of 7078 relevant lines covered (95.95%)

1.92 hits per line

Uncovered Changes

Lines Coverage ∆ File
3
93.19
-0.06% tests/test_multidict.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 35776927198.1 22 Sep 2026 07:56PM UTC 80
87.78
GitHub Action Run
Source Files on build 35776927198
  • Tree
  • List 40
  • 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 #35776927198
  • d647f3e0 on github
  • Prev Build on master (#35772873630)
  • Next Build on master (#35789385592)
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