Avatar for the astral-sh user
astral-sh
ruff
BlogDocsChangelog

Performance History

Latest Results

Render structured type alternatives as separate code spans
lerebear/push-xtqywqpsmllp
11 minutes ago
Bless blobs
epage:update-annotate
31 minutes ago
[`flake8-comprehensions`] NFKC-normalize keyword names in `C408` fix (#26813) Python normalizes identifiers to NFKC, but does not normalize string literals. The fix for `unnecessary-collection-call` (C408) reparses the call with libcst, which — unlike Ruff's own parser — does not normalize identifiers, and then emits the raw source text of each keyword argument as a dictionary key. This changed the key at runtime: `dict(ℼ=3.14)` has the key `π`, but was rewritten to `{"ℼ": 3.14}`. Normalize the keyword name before quoting it, matching what `fix::codemods` already does for qualified names built from libCST nodes. Fixes #16234 ## Summary Python normalizes identifiers to NFKC, but not string literals. The C408 fix re-parses the call with libcst, and that parser has a particular quirk: it does not normalize (Ruff's own parser does). So libcst hands over the raw source text of the kwarg as the key. `dict(ℼ=3.14)` has the key `π` at RUNTIME, but was rewritten to `{"ℼ": 3.14}` > this changes the behavior. My fix normalizes the kwarg name before quoting it. I'm not creating anything new, because `fix::codemods` already does the same thing. I decided not to mark it as unsafe, because the C408 fix is already unsafe. And unlike B009/B010/B043 (string > identifier, where preserving the behavior is impossible), C408 goes identifier > string. So the correct key can be computed :) ## Test Plan - 4 new cases at the end of `C408.py`: `ℼ`→`π`, `ſ`→`s`, `𝕒`→`a`, plus an ASCII control with no changes. - The snapshot diff is essentially additive. No diagnostic was altered. - The `allow_dict_calls_with_keyword_arguments` snapshot stayed INTACT. - `cargo test -p ruff_linter`: 2811 passed, 0 failed :) - `clippy --workspace --all-features -D warnings`: 100% clean. `generate-all`: up-to-date. And `prek run -a`: 14/14. Fixes #16234 --------- Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
main
53 minutes ago
Render structured type alternatives as separate code spans
lerebear/push-xtqywqpsmllp
55 minutes ago

Latest Branches

CodSpeed Performance Gauge
0%
[ty] Render structured type alternatives as separate code spans#27116
2 days ago
5848c66
lerebear/push-xtqywqpsmllp
CodSpeed Performance Gauge
0%
8 days ago
f0f1e02
lerebear/push-wrzqmxouryzx
CodSpeed Performance Gauge
0%
1 day ago
68db3a6
Jayashanker-Padishala:fix-27021-up040-typevar-default-order
© 2026 CodSpeed Technology
Home Terms Privacy Docs