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

aio-libs / multidict / 37464399849
86%

Build:
DEFAULT BRANCH: master
Ran 06 Oct 2026 12:36PM UTC
Jobs 1
Files 49
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

06 Oct 2026 12:35PM UTC coverage: 85.961%. Remained the same
37464399849

push

github

web-flow
Call PyUnstable_TryIncRef() instead of copying its fast path (#1688)

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

## What do these changes do?

Removes `_try_incref()` from `freethreading.h`. It copied the fast path
of `PyUnstable_TryIncRef()` (an immortal object, or one the current
thread owns) by reading `ob_ref_local` and calling
`_Py_IsOwnedByCurrentThread()`, which are CPython internals.
`try_get_ref()` now calls `PyUnstable_TryIncRef()` directly; its load,
take a reference, reload pattern stays, since CPython only has it
internally (`_Py_TryXGetRef()`).

This is a trade: every lock-free read on FT now makes a call into
CPython. Callgrind on 3.14.7t, Ir per op:

| op | master | this PR |
| --- | --- | --- |
| MultiDict `d[key]` | 196.8 | +10.5 (+5.3%) |
| MultiDict `d.get(key)`, miss | 356.1 | +9.5 (+2.7%) |
| MultiDict `key in d` | 164.1 | +3.0 (+1.8%) |
| MultiDict `d[istr]` | 820.8 | +23.0 (+2.8%) |
| CIMultiDict `d[istr]` | 209.6 | +3.0 (+1.4%) |
| CIMultiDict `d[key] = v`, `d[istr] = v` | | +4 (+0.8..0.9%) |

Every other row is flat. FT `.text` shrinks by 544 bytes. The GIL build
is byte-identical, and the pure-Python implementation has no equivalent.

## Are there changes in behavior for the user?

No.

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

No; it removes code that tracked CPython's private refcount layout.

## Related issue number

N/A

## Checklist

- [x] I think the code is well written
- [ ] Unit tests for the changes exist (N/A, no behavior change; the
existing lock-free read tests cover the path)
- [x] Documentation reflects the changes (N/A)
- [ ] 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 Code (Claude Opus 5.5); reviewed by @asvetlov.

<details>
<summary>Agent run details (optional, for r... (continued)

793 of 1586 branches covered (50.0%)

Branch coverage included in aggregate %.

9353 of 10217 relevant lines covered (91.54%)

1.83 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 37464399849.1 06 Oct 2026 12:36PM UTC 98
85.96
GitHub Action Run
Source Files on build 37464399849
  • Tree
  • List 49
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #37464399849
  • c454ff92 on github
  • Prev Build on master (#37461206892)
  • Next Build on master (#37470302828)
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